summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-10 13:57:40 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-07-10 13:57:40 -0400
commitf5c03fe1947653cbff5a9d5a60aa2314ce471b9c (patch)
tree7f9903558448fdfeb08e8725f35e76961e1217fa
parent65c47edc3dafee089507198f395a973767878c19 (diff)
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
-rw-r--r--src/tests/elementary/elm_suite.c3
-rw-r--r--src/tests/elementary/elm_test_genlist.c2
-rw-r--r--src/tests/elementary/elm_test_naviframe.c3
-rw-r--r--src/tests/elementary/suite_helpers.c7
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 @@
7#include "../efl_check.h" 7#include "../efl_check.h"
8#include "suite_helpers.h" 8#include "suite_helpers.h"
9 9
10extern Eina_Bool abort_on_warnings;
11
10static const Efl_Test_Case etc[] = { 12static const Efl_Test_Case etc[] = {
11 { "elm_config", elm_test_config }, 13 { "elm_config", elm_test_config },
12 { "elm_check", elm_test_check }, 14 { "elm_check", elm_test_check },
@@ -96,6 +98,7 @@ main(int argc, char **argv)
96 return 0; 98 return 0;
97 99
98 failed_count = suite_setup(EINA_TRUE); 100 failed_count = suite_setup(EINA_TRUE);
101 abort_on_warnings = EINA_TRUE;
99 102
100 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1, 103 failed_count += _efl_suite_build_and_run(argc - 1, (const char **)argv + 1,
101 "Elementary", etc, SUITE_INIT_FN(elm2), SUITE_SHUTDOWN_FN(elm)); 104 "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
454_do_quit() 454_do_quit()
455{ 455{
456 itc.func.content_get = NULL; 456 itc.func.content_get = NULL;
457 fail_on_errors_teardown();
458 ecore_main_loop_quit(); 457 ecore_main_loop_quit();
459} 458}
460 459
@@ -514,7 +513,6 @@ EFL_START_TEST(elm_genlist_test_tree_expand)
514 evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS); 513 evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS);
515 evas_object_show(win); 514 evas_object_show(win);
516 evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS); 515 evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS);
517 fail_on_errors_setup();
518 ecore_main_loop_begin(); 516 ecore_main_loop_begin();
519} 517}
520EFL_END_TEST 518EFL_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)
81 81
82 win = win_add(NULL, "naviframe", ELM_WIN_BASIC); 82 win = win_add(NULL, "naviframe", ELM_WIN_BASIC);
83 83
84 fail_on_errors_setup();
85
86 naviframe = elm_naviframe_add(win); 84 naviframe = elm_naviframe_add(win);
87 elm_naviframe_content_preserve_on_pop_set(naviframe, EINA_TRUE); 85 elm_naviframe_content_preserve_on_pop_set(naviframe, EINA_TRUE);
88 86
@@ -109,7 +107,6 @@ EFL_START_TEST(elm_naviframe_test_content_preserve_on_pop)
109 elm_object_signal_emit(button, "elm,action,click", "elm"); 107 elm_object_signal_emit(button, "elm,action,click", "elm");
110 108
111 ecore_main_loop_begin(); 109 ecore_main_loop_begin();
112 fail_on_errors_teardown();
113} 110}
114EFL_END_TEST 111EFL_END_TEST
115 112
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 @@
9#include "elm_widget.h" 9#include "elm_widget.h"
10#include "ecore_private.h" 10#include "ecore_private.h"
11#include "ecore_evas_private.h" 11#include "ecore_evas_private.h"
12#include "suite_helpers.h"
12 13
13 14
14static int main_pid = -1; 15static int main_pid = -1;
@@ -19,6 +20,8 @@ static Eina_Bool legacy_mode = EINA_FALSE;
19static int log_abort; 20static int log_abort;
20static int log_abort_level; 21static int log_abort_level;
21 22
23Eina_Bool abort_on_warnings = EINA_FALSE;
24
22void elm_test_init(TCase *tc); 25void elm_test_init(TCase *tc);
23 26
24SUITE_INIT(elm) 27SUITE_INIT(elm)
@@ -34,6 +37,8 @@ _elm2_suite_init(void)
34 37
35 if (getpid() != main_pid) 38 if (getpid() != main_pid)
36 { 39 {
40 if (abort_on_warnings)
41 fail_on_errors_setup();
37 ecore_fork_reset(); 42 ecore_fork_reset();
38 return; 43 return;
39 } 44 }
@@ -44,6 +49,8 @@ _elm2_suite_init(void)
44 did_shutdown = 1; 49 did_shutdown = 1;
45 } 50 }
46 ck_assert_int_eq(elm_init(1, args), 1); 51 ck_assert_int_eq(elm_init(1, args), 1);
52 if (abort_on_warnings)
53 fail_on_errors_setup();
47} 54}
48 55
49void 56void