From f5c03fe1947653cbff5a9d5a60aa2314ce471b9c Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 10 Jul 2019 13:57:40 -0400 Subject: [PATCH] tests/elm: fail tests if unexpected warnings or errors occur Summary: warnings and errors should never occur in unit tests unless they are intentionally triggered. this will help catch regressions Depends on D9256 Reviewers: bu5hm4n Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9257 --- src/tests/elementary/elm_suite.c | 3 +++ src/tests/elementary/elm_test_genlist.c | 2 -- src/tests/elementary/elm_test_naviframe.c | 3 --- src/tests/elementary/suite_helpers.c | 7 +++++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c index a1dc5de1b9..87fac6e4e1 100644 --- a/src/tests/elementary/elm_suite.c +++ b/src/tests/elementary/elm_suite.c @@ -7,6 +7,8 @@ #include "../efl_check.h" #include "suite_helpers.h" +extern Eina_Bool abort_on_warnings; + static const Efl_Test_Case etc[] = { { "elm_config", elm_test_config }, { "elm_check", elm_test_check }, @@ -96,6 +98,7 @@ main(int argc, char **argv) return 0; failed_count = suite_setup(EINA_TRUE); + abort_on_warnings = EINA_TRUE; failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, "Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm)); diff --git a/src/tests/elementary/elm_test_genlist.c b/src/tests/elementary/elm_test_genlist.c index 6532877926..8715d3be9f 100644 --- a/src/tests/elementary/elm_test_genlist.c +++ b/src/tests/elementary/elm_test_genlist.c @@ -454,7 +454,6 @@ static void _do_quit() { itc.func.content_get = NULL; - fail_on_errors_teardown(); ecore_main_loop_quit(); } @@ -514,7 +513,6 @@ EFL_START_TEST(elm_genlist_test_tree_expand) evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS); evas_object_show(win); evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS); - fail_on_errors_setup(); ecore_main_loop_begin(); } EFL_END_TEST diff --git a/src/tests/elementary/elm_test_naviframe.c b/src/tests/elementary/elm_test_naviframe.c index 336da14776..01f5dfc011 100644 --- a/src/tests/elementary/elm_test_naviframe.c +++ b/src/tests/elementary/elm_test_naviframe.c @@ -81,8 +81,6 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop) win = win_add(NULL, "naviframe", ELM_WIN_BASIC); - fail_on_errors_setup(); - naviframe = elm_naviframe_add(win); elm_naviframe_content_preserve_on_pop_set(naviframe, EINA_TRUE); @@ -109,7 +107,6 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop) elm_object_signal_emit(button, "elm,action,click", "elm"); ecore_main_loop_begin(); - fail_on_errors_teardown(); } EFL_END_TEST diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c index 6b7ffebc78..9d73c5d26b 100644 --- a/src/tests/elementary/suite_helpers.c +++ b/src/tests/elementary/suite_helpers.c @@ -9,6 +9,7 @@ #include "elm_widget.h" #include "ecore_private.h" #include "ecore_evas_private.h" +#include "suite_helpers.h" static int main_pid = -1; @@ -19,6 +20,8 @@ static Eina_Bool legacy_mode = EINA_FALSE; static int log_abort; static int log_abort_level; +Eina_Bool abort_on_warnings = EINA_FALSE; + void elm_test_init(TCase *tc); SUITE_INIT(elm) @@ -34,6 +37,8 @@ _elm2_suite_init(void) if (getpid() != main_pid) { + if (abort_on_warnings) + fail_on_errors_setup(); ecore_fork_reset(); return; } @@ -44,6 +49,8 @@ _elm2_suite_init(void) did_shutdown = 1; } ck_assert_int_eq(elm_init(1, args), 1); + if (abort_on_warnings) + fail_on_errors_setup(); } void