summaryrefslogtreecommitdiff
path: root/src/tests/ecore/ecore_test_ecore.c
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-03-27 13:51:13 -0400
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-05 11:10:26 +0200
commit624925fe6e9c72c639d47135d5ea70d4110ac1fe (patch)
treeb57c12a611bf3b4b492327a7fcb5722cd39dad5b /src/tests/ecore/ecore_test_ecore.c
parent730020c7d4a87daf60cbfbb3a0a912b4f75d8cb5 (diff)
tests: move to using checked fixtures for all test suites
individual tests should not need to explicitly call init/shutdown functions in most cases, and many did not properly do this anyway see followup commit which resolves some issues with eina tests ref T6813 ref T6811 Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com>
Diffstat (limited to 'src/tests/ecore/ecore_test_ecore.c')
-rw-r--r--src/tests/ecore/ecore_test_ecore.c93
1 files changed, 3 insertions, 90 deletions
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index acce1cc3d4..a09b09452c 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -33,13 +33,6 @@ _dummy_cb(void *data)
33 33
34EFL_START_TEST(ecore_test_ecore_init) 34EFL_START_TEST(ecore_test_ecore_init)
35{ 35{
36 int ret;
37
38 ret = ecore_init();
39 fail_if(ret < 1);
40
41 ret = ecore_shutdown();
42 fail_if(ret != 0);
43} 36}
44EFL_END_TEST 37EFL_END_TEST
45 38
@@ -47,10 +40,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop)
47{ 40{
48 Eina_Bool did = EINA_FALSE; 41 Eina_Bool did = EINA_FALSE;
49 Ecore_Timer *timer; 42 Ecore_Timer *timer;
50 int ret;
51
52 ret = ecore_init();
53 fail_if(ret < 1);
54 43
55 timer = ecore_timer_add(0.0, _quit_cb, &did); 44 timer = ecore_timer_add(0.0, _quit_cb, &did);
56 fail_if(timer == NULL); 45 fail_if(timer == NULL);
@@ -58,8 +47,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop)
58 ecore_main_loop_begin(); 47 ecore_main_loop_begin();
59 48
60 fail_if(did == EINA_FALSE); 49 fail_if(did == EINA_FALSE);
61
62 ret = ecore_shutdown();
63} 50}
64EFL_END_TEST 51EFL_END_TEST
65 52
@@ -67,10 +54,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idler)
67{ 54{
68 Eina_Bool did = EINA_FALSE; 55 Eina_Bool did = EINA_FALSE;
69 Ecore_Idler *idler; 56 Ecore_Idler *idler;
70 int ret;
71
72 ret = ecore_init();
73 fail_if(ret < 1);
74 57
75 idler = ecore_idler_add(_quit_cb, &did); 58 idler = ecore_idler_add(_quit_cb, &did);
76 fail_if(idler == NULL); 59 fail_if(idler == NULL);
@@ -78,8 +61,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idler)
78 ecore_main_loop_begin(); 61 ecore_main_loop_begin();
79 62
80 fail_if(did == EINA_FALSE); 63 fail_if(did == EINA_FALSE);
81
82 ret = ecore_shutdown();
83} 64}
84EFL_END_TEST 65EFL_END_TEST
85 66
@@ -87,10 +68,7 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
87{ 68{
88 Eina_Bool did = EINA_FALSE; 69 Eina_Bool did = EINA_FALSE;
89 Ecore_Idle_Enterer *idle_enterer; 70 Ecore_Idle_Enterer *idle_enterer;
90 int ret;
91 71
92 ret = ecore_init();
93 fail_if(ret < 1);
94 72
95 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did); 73 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
96 fail_if(idle_enterer == NULL); 74 fail_if(idle_enterer == NULL);
@@ -99,7 +77,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_enterer)
99 77
100 fail_if(did == EINA_FALSE); 78 fail_if(did == EINA_FALSE);
101 79
102 ret = ecore_shutdown();
103} 80}
104EFL_END_TEST 81EFL_END_TEST
105 82
@@ -107,10 +84,7 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
107{ 84{
108 Eina_Bool did = EINA_FALSE; 85 Eina_Bool did = EINA_FALSE;
109 Ecore_Idle_Enterer *idle_enterer; 86 Ecore_Idle_Enterer *idle_enterer;
110 int ret;
111 87
112 ret = ecore_init();
113 fail_if(ret < 1);
114 88
115 idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did); 89 idle_enterer = ecore_idle_enterer_before_add(_quit_cb, &did);
116 fail_if(idle_enterer == NULL); 90 fail_if(idle_enterer == NULL);
@@ -119,7 +93,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_before_enterer)
119 93
120 fail_if(did == EINA_FALSE); 94 fail_if(did == EINA_FALSE);
121 95
122 ret = ecore_shutdown();
123} 96}
124EFL_END_TEST 97EFL_END_TEST
125 98
@@ -128,10 +101,7 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
128 Eina_Bool did = EINA_FALSE; 101 Eina_Bool did = EINA_FALSE;
129 Ecore_Timer *timer; 102 Ecore_Timer *timer;
130 Ecore_Idle_Exiter *idle_exiter; 103 Ecore_Idle_Exiter *idle_exiter;
131 int ret;
132 104
133 ret = ecore_init();
134 fail_if(ret < 1);
135 105
136 /* make system exit idle */ 106 /* make system exit idle */
137 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0); 107 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
@@ -144,7 +114,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_idle_exiter)
144 114
145 fail_if(did == EINA_FALSE); 115 fail_if(did == EINA_FALSE);
146 116
147 ret = ecore_shutdown();
148} 117}
149EFL_END_TEST 118EFL_END_TEST
150 119
@@ -153,10 +122,7 @@ EFL_START_TEST(ecore_test_ecore_main_loop_timer)
153 Eina_Bool did = EINA_FALSE; 122 Eina_Bool did = EINA_FALSE;
154 Ecore_Timer *timer; 123 Ecore_Timer *timer;
155 double start, end, elapsed; 124 double start, end, elapsed;
156 int ret;
157 125
158 ret = ecore_init();
159 fail_if(ret < 1);
160 126
161 timer = ecore_timer_add(2.0, _quit_cb, &did); 127 timer = ecore_timer_add(2.0, _quit_cb, &did);
162 fail_if(timer == NULL); 128 fail_if(timer == NULL);
@@ -170,7 +136,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_timer)
170 fail_if(elapsed < 2.0); 136 fail_if(elapsed < 2.0);
171 fail_if(elapsed > 3.0); /* 1 second "error margin" */ 137 fail_if(elapsed > 3.0); /* 1 second "error margin" */
172 138
173 ret = ecore_shutdown();
174} 139}
175EFL_END_TEST 140EFL_END_TEST
176 141
@@ -207,12 +172,8 @@ static Eina_Bool _timer1(void *data)
207EFL_START_TEST(ecore_test_ecore_main_loop_timer_inner) 172EFL_START_TEST(ecore_test_ecore_main_loop_timer_inner)
208{ 173{
209 Ecore_Timer *timer; 174 Ecore_Timer *timer;
210 int ret;
211 int times = 0; 175 int times = 0;
212 176
213 ret = ecore_init();
214 fail_if(ret < 1);
215
216 timer = ecore_timer_add(1.0, _timer1, &times); 177 timer = ecore_timer_add(1.0, _timer1, &times);
217 fail_if(timer == NULL); 178 fail_if(timer == NULL);
218 179
@@ -221,8 +182,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_timer_inner)
221 /*END: outer mainloop */ 182 /*END: outer mainloop */
222 183
223 fail_if(times != 1); 184 fail_if(times != 1);
224
225 ecore_shutdown();
226} 185}
227EFL_END_TEST 186EFL_END_TEST
228#endif 187#endif
@@ -245,9 +204,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler)
245 int comm[2]; 204 int comm[2];
246 int ret; 205 int ret;
247 206
248 ret = ecore_init();
249 fail_if(ret < 1);
250
251 ret = pipe(comm); 207 ret = pipe(comm);
252 fail_if(ret != 0); 208 fail_if(ret != 0);
253 209
@@ -265,7 +221,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler)
265 221
266 fail_if(did == EINA_FALSE); 222 fail_if(did == EINA_FALSE);
267 223
268 ret = ecore_shutdown();
269} 224}
270EFL_END_TEST 225EFL_END_TEST
271 226
@@ -275,9 +230,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler_valid_flags)
275 int comm[2]; 230 int comm[2];
276 int ret; 231 int ret;
277 232
278 ret = ecore_init();
279 fail_if(ret < 1);
280
281 ret = pipe(comm); 233 ret = pipe(comm);
282 fail_if(ret != 0); 234 fail_if(ret != 0);
283 235
@@ -290,8 +242,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler_valid_flags)
290 242
291 close(comm[0]); 243 close(comm[0]);
292 close(comm[1]); 244 close(comm[1]);
293
294 ecore_shutdown();
295} 245}
296EFL_END_TEST 246EFL_END_TEST
297 247
@@ -311,9 +261,6 @@ EFL_START_TEST(ecore_test_efl_loop_fd)
311 int comm[2]; 261 int comm[2];
312 int ret; 262 int ret;
313 263
314 ret = ecore_init();
315 fail_if(ret < 1);
316
317 ret = pipe(comm); 264 ret = pipe(comm);
318 fail_if(ret != 0); 265 fail_if(ret != 0);
319 266
@@ -332,7 +279,6 @@ EFL_START_TEST(ecore_test_efl_loop_fd)
332 279
333 fail_if(did == EINA_FALSE); 280 fail_if(did == EINA_FALSE);
334 281
335 ret = ecore_shutdown();
336} 282}
337EFL_END_TEST 283EFL_END_TEST
338 284
@@ -354,9 +300,6 @@ EFL_START_TEST(ecore_test_efl_loop_fd_lifecycle)
354 300
355 efl_object_init(); 301 efl_object_init();
356 302
357 ret = ecore_init();
358 fail_if(ret < 1);
359
360 ret = pipe(comm); 303 ret = pipe(comm);
361 fail_if(ret != 0); 304 fail_if(ret != 0);
362 305
@@ -378,7 +321,8 @@ EFL_START_TEST(ecore_test_efl_loop_fd_lifecycle)
378 fail_if(did == EINA_FALSE); 321 fail_if(did == EINA_FALSE);
379 fail_if(dead == EINA_TRUE); 322 fail_if(dead == EINA_TRUE);
380 323
381 ret = ecore_shutdown(); 324 ecore_shutdown();
325 ecore_init();
382 326
383 efl_del(fd); 327 efl_del(fd);
384 fail_if(dead == EINA_FALSE); 328 fail_if(dead == EINA_FALSE);
@@ -394,9 +338,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler_activate_modify)
394 int comm[2]; 338 int comm[2];
395 int ret; 339 int ret;
396 340
397 ret = ecore_init();
398 fail_if(ret < 1);
399
400 ret = pipe(comm); 341 ret = pipe(comm);
401 fail_if(ret != 0); 342 fail_if(ret != 0);
402 343
@@ -416,7 +357,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_fd_handler_activate_modify)
416 357
417 fail_if(did != EINA_TRUE); 358 fail_if(did != EINA_TRUE);
418 359
419 ret = ecore_shutdown();
420} 360}
421EFL_END_TEST 361EFL_END_TEST
422 362
@@ -532,15 +472,11 @@ EFL_START_TEST(ecore_test_ecore_main_loop_event)
532 Ecore_Event_Filter *filter_handler; 472 Ecore_Event_Filter *filter_handler;
533 Ecore_Event *event; 473 Ecore_Event *event;
534 Ecore_Event *event2; 474 Ecore_Event *event2;
535 int res_counter;
536 int type, type2; 475 int type, type2;
537 int *ev = NULL; 476 int *ev = NULL;
538 int did = 0; 477 int did = 0;
539 int filter = 0; 478 int filter = 0;
540 479
541 res_counter = ecore_init();
542 fail_if(res_counter < 1);
543
544 /* Create 2 new event types */ 480 /* Create 2 new event types */
545 type = ecore_event_type_new(); 481 type = ecore_event_type_new();
546 fail_if(type < 1); 482 fail_if(type < 1);
@@ -627,8 +563,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_event)
627 563
628 /* Filter counter shouldn't change */ 564 /* Filter counter shouldn't change */
629 fail_if(filter != 0); // 0 565 fail_if(filter != 0); // 0
630
631 res_counter = ecore_shutdown();
632} 566}
633EFL_END_TEST 567EFL_END_TEST
634 568
@@ -678,14 +612,10 @@ EFL_START_TEST(ecore_test_ecore_main_loop_event_recursive)
678 */ 612 */
679 Ecore_Event *e; 613 Ecore_Event *e;
680 int type; 614 int type;
681 int ret;
682 615
683 _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN); 616 _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN);
684 617
685 INF("main: begin"); 618 INF("main: begin");
686 ret = ecore_init();
687 fail_if(ret < 1);
688
689 619
690 type = ecore_event_type_new(); 620 type = ecore_event_type_new();
691 ecore_event_handler_add(type, _event_recursive_cb, NULL); 621 ecore_event_handler_add(type, _event_recursive_cb, NULL);
@@ -696,24 +626,18 @@ EFL_START_TEST(ecore_test_ecore_main_loop_event_recursive)
696 INF(" main loop end"); 626 INF(" main loop end");
697 627
698 INF("main: end"); 628 INF("main: end");
699 ecore_shutdown();
700} 629}
701EFL_END_TEST 630EFL_END_TEST
702#endif 631#endif
703 632
704EFL_START_TEST(ecore_test_ecore_app) 633EFL_START_TEST(ecore_test_ecore_app)
705{ 634{
706 int ret;
707
708 int argc_in = 2; 635 int argc_in = 2;
709 const char *argv_in[] = {"arg_str_1", "arg_str2"}; 636 const char *argv_in[] = {"arg_str_1", "arg_str2"};
710 637
711 int argc_out = 0; 638 int argc_out = 0;
712 char **argv_out = NULL; 639 char **argv_out = NULL;
713 640
714 ret = ecore_init();
715 fail_if(ret < 1);
716
717 ecore_app_args_set(argc_in, argv_in); 641 ecore_app_args_set(argc_in, argv_in);
718 ecore_app_args_get(&argc_out, &argv_out); 642 ecore_app_args_get(&argc_out, &argv_out);
719 643
@@ -724,7 +648,6 @@ EFL_START_TEST(ecore_test_ecore_app)
724 fail_if( 0 != strcmp(argv_in[i], argv_out[i]) ); 648 fail_if( 0 != strcmp(argv_in[i], argv_out[i]) );
725 } 649 }
726 650
727 ret = ecore_shutdown();
728} 651}
729EFL_END_TEST 652EFL_END_TEST
730 653
@@ -737,8 +660,6 @@ Eina_Bool _poller_cb(void *data)
737 660
738EFL_START_TEST(ecore_test_ecore_main_loop_poller) 661EFL_START_TEST(ecore_test_ecore_main_loop_poller)
739{ 662{
740 int ret;
741
742 Ecore_Poller *poll1_ptr = NULL; 663 Ecore_Poller *poll1_ptr = NULL;
743 int poll1_interval = 1; 664 int poll1_interval = 1;
744 int poll1_counter = 0; 665 int poll1_counter = 0;
@@ -753,9 +674,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_poller)
753 674
754 Eina_Bool did = EINA_FALSE; 675 Eina_Bool did = EINA_FALSE;
755 676
756 ret = ecore_init();
757 fail_if(ret < 1);
758
759 /* Check ECORE_POLLER_CORE poll interval */ 677 /* Check ECORE_POLLER_CORE poll interval */
760 double interval = 1.0; 678 double interval = 1.0;
761 ecore_poller_poll_interval_set(ECORE_POLLER_CORE, interval); 679 ecore_poller_poll_interval_set(ECORE_POLLER_CORE, interval);
@@ -789,7 +707,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_poller)
789 707
790 fail_if(did == EINA_FALSE); 708 fail_if(did == EINA_FALSE);
791 709
792 ret = ecore_shutdown();
793} 710}
794EFL_END_TEST 711EFL_END_TEST
795 712
@@ -828,13 +745,10 @@ Eina_Bool _poller_loop(void *data)
828 745
829EFL_START_TEST(ecore_test_ecore_main_loop_poller_add_del) 746EFL_START_TEST(ecore_test_ecore_main_loop_poller_add_del)
830{ 747{
831 int ret, count_res = 0; 748 int count_res = 0;
832 749
833 Eina_Bool did = EINA_FALSE; 750 Eina_Bool did = EINA_FALSE;
834 751
835 ret = ecore_init();
836 fail_if(ret < 1);
837
838 /* Create renewable main poller */ 752 /* Create renewable main poller */
839 Ecore_Poller *poll_ptr = ecore_poller_add(ECORE_POLLER_CORE, 1, _poller_loop, &count_res); 753 Ecore_Poller *poll_ptr = ecore_poller_add(ECORE_POLLER_CORE, 1, _poller_loop, &count_res);
840 754
@@ -853,7 +767,6 @@ EFL_START_TEST(ecore_test_ecore_main_loop_poller_add_del)
853 767
854 fail_if(did == EINA_FALSE); 768 fail_if(did == EINA_FALSE);
855 769
856 ret = ecore_shutdown();
857} 770}
858EFL_END_TEST 771EFL_END_TEST
859 772