summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-28 12:01:57 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-28 12:01:57 -0400
commit8721caf787ce1a9abb6198f41bfc1a033d4f799a (patch)
tree2ec813d4f045cfa658302385d4baa36f3f114a43
parent52b2701bc3bfb64a3f6ca4ce0b992ac83d7c9e73 (diff)
efl_ui: add a helper for not tollerating errors in a testsuite
Summary: We now also fail in the focus tests Depends on D9021 Reviewers: zmike, cedric, segfaultxavi Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9022
-rw-r--r--src/tests/elementary/efl_ui_test_focus.c2
-rw-r--r--src/tests/elementary/efl_ui_test_widget.c22
-rw-r--r--src/tests/elementary/elm_test_genlist.c13
-rw-r--r--src/tests/elementary/spec/efl_ui_spec_suite.c18
-rwxr-xr-xsrc/tests/elementary/spec/generator.py2
-rw-r--r--src/tests/elementary/suite_helpers.c18
-rw-r--r--src/tests/elementary/suite_helpers.h2
7 files changed, 28 insertions, 49 deletions
diff --git a/src/tests/elementary/efl_ui_test_focus.c b/src/tests/elementary/efl_ui_test_focus.c
index 38a2ac0200..8e754592e8 100644
--- a/src/tests/elementary/efl_ui_test_focus.c
+++ b/src/tests/elementary/efl_ui_test_focus.c
@@ -1,4 +1,5 @@
1#include "efl_ui_test_focus_common.h" 1#include "efl_ui_test_focus_common.h"
2#include "suite_helpers.h"
2 3
3EFL_START_TEST(focus_unregister_twice) 4EFL_START_TEST(focus_unregister_twice)
4{ 5{
@@ -1072,6 +1073,7 @@ EFL_END_TEST
1072 1073
1073void efl_ui_test_focus(TCase *tc) 1074void efl_ui_test_focus(TCase *tc)
1074{ 1075{
1076 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
1075 tcase_add_test(tc, focus_register_twice); 1077 tcase_add_test(tc, focus_register_twice);
1076 tcase_add_test(tc, focus_unregister_twice); 1078 tcase_add_test(tc, focus_unregister_twice);
1077 tcase_add_test(tc, pos_check); 1079 tcase_add_test(tc, pos_check);
diff --git a/src/tests/elementary/efl_ui_test_widget.c b/src/tests/elementary/efl_ui_test_widget.c
index 00e5293eff..79d172fa14 100644
--- a/src/tests/elementary/efl_ui_test_widget.c
+++ b/src/tests/elementary/efl_ui_test_widget.c
@@ -7,6 +7,7 @@
7#include <Efl_Ui.h> 7#include <Efl_Ui.h>
8#include "efl_ui_suite.h" 8#include "efl_ui_suite.h"
9#include "eo_internal.h" 9#include "eo_internal.h"
10#include "suite_helpers.h"
10 11
11EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS) 12EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS)
12 13
@@ -326,25 +327,6 @@ EFL_START_TEST(efl_ui_test_widget_disabled_behaviour)
326} 327}
327EFL_END_TEST 328EFL_END_TEST
328 329
329static int tree_abort;
330static int tree_abort_level;
331
332static void
333_shutdown(void)
334{
335 eina_log_abort_on_critical_set(tree_abort);
336 eina_log_abort_on_critical_level_set(tree_abort_level);
337}
338
339static void
340_setup(void)
341{
342 tree_abort = eina_log_abort_on_critical_get();
343 tree_abort_level = eina_log_abort_on_critical_level_get();
344 eina_log_abort_on_critical_level_set(2);
345 eina_log_abort_on_critical_set(1);
346}
347
348EFL_START_TEST(efl_ui_test_widget_win_provider_find) 330EFL_START_TEST(efl_ui_test_widget_win_provider_find)
349{ 331{
350 State s; 332 State s;
@@ -359,7 +341,7 @@ EFL_END_TEST
359 341
360void efl_ui_test_widget(TCase *tc) 342void efl_ui_test_widget(TCase *tc)
361{ 343{
362 tcase_add_checked_fixture(tc, _setup, _shutdown); 344 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
363 tcase_add_test(tc, efl_ui_test_widget_parent_iterator); 345 tcase_add_test(tc, efl_ui_test_widget_parent_iterator);
364 tcase_add_test(tc, efl_ui_test_widget_widget_iterator); 346 tcase_add_test(tc, efl_ui_test_widget_widget_iterator);
365 tcase_add_test(tc, efl_ui_test_widget_widget_sub_iterator); 347 tcase_add_test(tc, efl_ui_test_widget_widget_sub_iterator);
diff --git a/src/tests/elementary/elm_test_genlist.c b/src/tests/elementary/elm_test_genlist.c
index 1ffec17647..2fea52e4c8 100644
--- a/src/tests/elementary/elm_test_genlist.c
+++ b/src/tests/elementary/elm_test_genlist.c
@@ -6,6 +6,7 @@
6#define EFL_ACCESS_OBJECT_PROTECTED 6#define EFL_ACCESS_OBJECT_PROTECTED
7#include <Elementary.h> 7#include <Elementary.h>
8#include "elm_suite.h" 8#include "elm_suite.h"
9#include "suite_helpers.h"
9 10
10static Evas_Object *win, *genlist; 11static Evas_Object *win, *genlist;
11static Elm_Gen_Item_Class itc = { .version = ELM_GENLIST_ITEM_CLASS_VERSION }; 12static Elm_Gen_Item_Class itc = { .version = ELM_GENLIST_ITEM_CLASS_VERSION };
@@ -14,9 +15,6 @@ static int counter;
14static Efl_Access_Event_Children_Changed_Data ev_data; 15static Efl_Access_Event_Children_Changed_Data ev_data;
15Evas_Object *content; 16Evas_Object *content;
16 17
17static int tree_abort_level;
18static int tree_abort;
19
20static void 18static void
21verify_item_iteration_api(Elm_Object_Item *parent) 19verify_item_iteration_api(Elm_Object_Item *parent)
22{ 20{
@@ -452,8 +450,7 @@ static void
452_do_quit() 450_do_quit()
453{ 451{
454 itc.func.content_get = NULL; 452 itc.func.content_get = NULL;
455 eina_log_abort_on_critical_set(tree_abort); 453 fail_on_errors_teardown();
456 eina_log_abort_on_critical_level_set(tree_abort_level);
457 ecore_main_loop_quit(); 454 ecore_main_loop_quit();
458} 455}
459 456
@@ -513,11 +510,7 @@ EFL_START_TEST(elm_genlist_test_tree_expand)
513 evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS); 510 evas_object_resize(genlist, 100, 10 + 10 * NUM_TREE_ITEMS);
514 evas_object_show(win); 511 evas_object_show(win);
515 evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS); 512 evas_object_resize(win, 100, 10 + 10 * NUM_TREE_ITEMS);
516 tree_abort = eina_log_abort_on_critical_get(); 513 fail_on_errors_setup();
517 tree_abort_level = eina_log_abort_on_critical_level_get();
518 /* this should never trigger errors */
519 eina_log_abort_on_critical_level_set(1);
520 eina_log_abort_on_critical_set(1);
521 ecore_main_loop_begin(); 514 ecore_main_loop_begin();
522} 515}
523EFL_END_TEST 516EFL_END_TEST
diff --git a/src/tests/elementary/spec/efl_ui_spec_suite.c b/src/tests/elementary/spec/efl_ui_spec_suite.c
index 9dd476528d..5c98af28a5 100644
--- a/src/tests/elementary/spec/efl_ui_spec_suite.c
+++ b/src/tests/elementary/spec/efl_ui_spec_suite.c
@@ -12,24 +12,6 @@ Evas_Object *win = NULL;
12Evas_Object *widget = NULL; 12Evas_Object *widget = NULL;
13const Efl_Class *test_content_klass = NULL; 13const Efl_Class *test_content_klass = NULL;
14EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS); 14EFL_CLASS_SIMPLE_CLASS(efl_ui_widget, "efl_ui_widget", EFL_UI_WIDGET_CLASS);
15static int tree_abort;
16static int tree_abort_level;
17
18static void
19_shutdown(void)
20{
21 eina_log_abort_on_critical_set(tree_abort);
22 eina_log_abort_on_critical_level_set(tree_abort_level);
23}
24
25static void
26_setup(void)
27{
28 tree_abort = eina_log_abort_on_critical_get();
29 tree_abort_level = eina_log_abort_on_critical_level_get();
30 eina_log_abort_on_critical_level_set(2);
31 eina_log_abort_on_critical_set(1);
32}
33 15
34static void 16static void
35_setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass) 17_setup_window_and_widget(const Efl_Class *klass, const Efl_Class *content_klass)
diff --git a/src/tests/elementary/spec/generator.py b/src/tests/elementary/spec/generator.py
index 15042d3afd..c11ab21fdd 100755
--- a/src/tests/elementary/spec/generator.py
+++ b/src/tests/elementary/spec/generator.py
@@ -13,7 +13,7 @@ static void
13{}(TCase *tc) 13{}(TCase *tc)
14{{ 14{{
15 tcase_add_checked_fixture(tc, _{}_fixture, NULL); 15 tcase_add_checked_fixture(tc, _{}_fixture, NULL);
16 tcase_add_checked_fixture(tc, _setup, _shutdown); 16 tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
17 {}(tc); 17 {}(tc);
18}} 18}}
19 19
diff --git a/src/tests/elementary/suite_helpers.c b/src/tests/elementary/suite_helpers.c
index a57ae493fa..e5d43c38b9 100644
--- a/src/tests/elementary/suite_helpers.c
+++ b/src/tests/elementary/suite_helpers.c
@@ -16,6 +16,8 @@ static Eina_Bool did_shutdown;
16static Evas_Object *global_win; 16static Evas_Object *global_win;
17static Eina_Bool buffer = EINA_FALSE; 17static Eina_Bool buffer = EINA_FALSE;
18static Eina_Bool legacy_mode = EINA_FALSE; 18static Eina_Bool legacy_mode = EINA_FALSE;
19static int log_abort;
20static int log_abort_level;
19 21
20void elm_test_init(TCase *tc); 22void elm_test_init(TCase *tc);
21 23
@@ -340,3 +342,19 @@ suite_setup(Eina_Bool legacy)
340 } 342 }
341 return 0; 343 return 0;
342} 344}
345
346void
347fail_on_errors_teardown(void)
348{
349 eina_log_abort_on_critical_set(log_abort);
350 eina_log_abort_on_critical_level_set(log_abort_level);
351}
352
353void
354fail_on_errors_setup(void)
355{
356 log_abort = eina_log_abort_on_critical_get();
357 log_abort_level = eina_log_abort_on_critical_level_get();
358 eina_log_abort_on_critical_level_set(2);
359 eina_log_abort_on_critical_set(1);
360}
diff --git a/src/tests/elementary/suite_helpers.h b/src/tests/elementary/suite_helpers.h
index 903fa02929..75cc0487d3 100644
--- a/src/tests/elementary/suite_helpers.h
+++ b/src/tests/elementary/suite_helpers.h
@@ -7,5 +7,7 @@ int suite_setup(Eina_Bool legacy);
7void _elm2_suite_init(void); 7void _elm2_suite_init(void);
8void _elm_suite_shutdown(void); 8void _elm_suite_shutdown(void);
9void *real_timer_add(double in, Ecore_Task_Cb cb, void *data); 9void *real_timer_add(double in, Ecore_Task_Cb cb, void *data);
10void fail_on_errors_teardown(void);
11void fail_on_errors_setup(void);
10 12
11#endif 13#endif