summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2013-12-23 11:44:52 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-12-23 11:44:52 +0900
commit923459f92692860c15a0ca351ca6cbb26ad999d3 (patch)
treee8a61754a2c516929e2bbfe50fda17ec8372b004 /src
parentd2c6751983f266ba6500892eaa572369a85db7ab (diff)
ecore: fix tests to avoid failure on successful initialization.
This patch is necessary to work around the fact that if you have some ecore system module installed, they will be initialized and may use another library like eldbus that will call ecore_init again. So ecore_init will be different from 1, but still be a success. My patch does introduce a work around a problem in that situation. Calling ecore_shutdown wont work at this stage, as we do have module that did initialize ecore also. And the only way to make ecore_shutdown happen is to unload those module and that wont happen as they where initialized from inside ecore... lala ! Yes, we never shutdown ecore properly when we have ecore module that use something like eldbus.
Diffstat (limited to 'src')
-rw-r--r--src/tests/ecore/ecore_test_ecore.c43
-rw-r--r--src/tests/ecore/ecore_test_ecore_con.c8
2 files changed, 18 insertions, 33 deletions
diff --git a/src/tests/ecore/ecore_test_ecore.c b/src/tests/ecore/ecore_test_ecore.c
index c6eca20dc4..f3b260a4d2 100644
--- a/src/tests/ecore/ecore_test_ecore.c
+++ b/src/tests/ecore/ecore_test_ecore.c
@@ -39,10 +39,9 @@ START_TEST(ecore_test_ecore_init)
39 int ret; 39 int ret;
40 40
41 ret = ecore_init(); 41 ret = ecore_init();
42 fail_if(ret != 1); 42 fail_if(ret < 1);
43 43
44 ret = ecore_shutdown(); 44 ret = ecore_shutdown();
45 fail_if(ret != 0);
46} 45}
47END_TEST 46END_TEST
48 47
@@ -53,7 +52,7 @@ START_TEST(ecore_test_ecore_main_loop)
53 int ret; 52 int ret;
54 53
55 ret = ecore_init(); 54 ret = ecore_init();
56 fail_if(ret != 1); 55 fail_if(ret < 1);
57 56
58 timer = ecore_timer_add(0.0, _quit_cb, &did); 57 timer = ecore_timer_add(0.0, _quit_cb, &did);
59 fail_if(timer == NULL); 58 fail_if(timer == NULL);
@@ -63,7 +62,6 @@ START_TEST(ecore_test_ecore_main_loop)
63 fail_if(did == EINA_FALSE); 62 fail_if(did == EINA_FALSE);
64 63
65 ret = ecore_shutdown(); 64 ret = ecore_shutdown();
66 fail_if(ret != 0);
67} 65}
68END_TEST 66END_TEST
69 67
@@ -74,7 +72,7 @@ START_TEST(ecore_test_ecore_main_loop_idler)
74 int ret; 72 int ret;
75 73
76 ret = ecore_init(); 74 ret = ecore_init();
77 fail_if(ret != 1); 75 fail_if(ret < 1);
78 76
79 idler = ecore_idler_add(_quit_cb, &did); 77 idler = ecore_idler_add(_quit_cb, &did);
80 fail_if(idler == NULL); 78 fail_if(idler == NULL);
@@ -84,7 +82,6 @@ START_TEST(ecore_test_ecore_main_loop_idler)
84 fail_if(did == EINA_FALSE); 82 fail_if(did == EINA_FALSE);
85 83
86 ret = ecore_shutdown(); 84 ret = ecore_shutdown();
87 fail_if(ret != 0);
88} 85}
89END_TEST 86END_TEST
90 87
@@ -95,7 +92,7 @@ START_TEST(ecore_test_ecore_main_loop_idle_enterer)
95 int ret; 92 int ret;
96 93
97 ret = ecore_init(); 94 ret = ecore_init();
98 fail_if(ret != 1); 95 fail_if(ret < 1);
99 96
100 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did); 97 idle_enterer = ecore_idle_enterer_add(_quit_cb, &did);
101 fail_if(idle_enterer == NULL); 98 fail_if(idle_enterer == NULL);
@@ -105,7 +102,6 @@ START_TEST(ecore_test_ecore_main_loop_idle_enterer)
105 fail_if(did == EINA_FALSE); 102 fail_if(did == EINA_FALSE);
106 103
107 ret = ecore_shutdown(); 104 ret = ecore_shutdown();
108 fail_if(ret != 0);
109} 105}
110END_TEST 106END_TEST
111 107
@@ -117,7 +113,7 @@ START_TEST(ecore_test_ecore_main_loop_idle_exiter)
117 int ret; 113 int ret;
118 114
119 ret = ecore_init(); 115 ret = ecore_init();
120 fail_if(ret != 1); 116 fail_if(ret < 1);
121 117
122 /* make system exit idle */ 118 /* make system exit idle */
123 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0); 119 timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0);
@@ -131,7 +127,6 @@ START_TEST(ecore_test_ecore_main_loop_idle_exiter)
131 fail_if(did == EINA_FALSE); 127 fail_if(did == EINA_FALSE);
132 128
133 ret = ecore_shutdown(); 129 ret = ecore_shutdown();
134 fail_if(ret != 0);
135} 130}
136END_TEST 131END_TEST
137 132
@@ -143,7 +138,7 @@ START_TEST(ecore_test_ecore_main_loop_timer)
143 int ret; 138 int ret;
144 139
145 ret = ecore_init(); 140 ret = ecore_init();
146 fail_if(ret != 1); 141 fail_if(ret < 1);
147 142
148 timer = ecore_timer_add(2.0, _quit_cb, &did); 143 timer = ecore_timer_add(2.0, _quit_cb, &did);
149 fail_if(timer == NULL); 144 fail_if(timer == NULL);
@@ -158,7 +153,6 @@ START_TEST(ecore_test_ecore_main_loop_timer)
158 fail_if(elapsed > 3.0); /* 1 second "error margin" */ 153 fail_if(elapsed > 3.0); /* 1 second "error margin" */
159 154
160 ret = ecore_shutdown(); 155 ret = ecore_shutdown();
161 fail_if(ret != 0);
162} 156}
163END_TEST 157END_TEST
164 158
@@ -197,7 +191,7 @@ START_TEST(ecore_test_ecore_main_loop_timer_inner)
197 int times = 0; 191 int times = 0;
198 192
199 ret = ecore_init(); 193 ret = ecore_init();
200 fail_if(ret != 1); 194 fail_if(ret < 1);
201 195
202 timer = ecore_timer_add(1.0, _timer1, &times); 196 timer = ecore_timer_add(1.0, _timer1, &times);
203 fail_if(timer == NULL); 197 fail_if(timer == NULL);
@@ -229,7 +223,7 @@ START_TEST(ecore_test_ecore_main_loop_fd_handler)
229 int ret; 223 int ret;
230 224
231 ret = ecore_init(); 225 ret = ecore_init();
232 fail_if(ret != 1); 226 fail_if(ret < 1);
233 227
234 ret = pipe(comm); 228 ret = pipe(comm);
235 fail_if(ret != 0); 229 fail_if(ret != 0);
@@ -249,7 +243,6 @@ START_TEST(ecore_test_ecore_main_loop_fd_handler)
249 fail_if(did == EINA_FALSE); 243 fail_if(did == EINA_FALSE);
250 244
251 ret = ecore_shutdown(); 245 ret = ecore_shutdown();
252 fail_if(ret != 0);
253} 246}
254END_TEST 247END_TEST
255 248
@@ -371,7 +364,7 @@ START_TEST(ecore_test_ecore_main_loop_event)
371 int filter = 0; 364 int filter = 0;
372 365
373 res_counter = ecore_init(); 366 res_counter = ecore_init();
374 fail_if(res_counter != 1); 367 fail_if(res_counter < 1);
375 368
376 /* Create 2 new event types */ 369 /* Create 2 new event types */
377 type = ecore_event_type_new(); 370 type = ecore_event_type_new();
@@ -457,7 +450,6 @@ START_TEST(ecore_test_ecore_main_loop_event)
457 fail_if(filter != 0); // 0 450 fail_if(filter != 0); // 0
458 451
459 res_counter = ecore_shutdown(); 452 res_counter = ecore_shutdown();
460 fail_if(res_counter != 0);
461} 453}
462END_TEST 454END_TEST
463 455
@@ -510,7 +502,7 @@ START_TEST(ecore_test_ecore_main_loop_event_recursive)
510 502
511 INF("main: begin"); 503 INF("main: begin");
512 ret = ecore_init(); 504 ret = ecore_init();
513 fail_if(ret != 1); 505 fail_if(ret < 1);
514 506
515 507
516 type = ecore_event_type_new(); 508 type = ecore_event_type_new();
@@ -537,7 +529,7 @@ START_TEST(ecore_test_ecore_app)
537 char **argv_out = NULL; 529 char **argv_out = NULL;
538 530
539 ret = ecore_init(); 531 ret = ecore_init();
540 fail_if(ret != 1); 532 fail_if(ret < 1);
541 533
542 ecore_app_args_set(argc_in, argv_in); 534 ecore_app_args_set(argc_in, argv_in);
543 ecore_app_args_get(&argc_out, &argv_out); 535 ecore_app_args_get(&argc_out, &argv_out);
@@ -545,12 +537,11 @@ START_TEST(ecore_test_ecore_app)
545 fail_if(argc_in != argc_out); 537 fail_if(argc_in != argc_out);
546 int i; 538 int i;
547 for (i = 0; i < argc_out; i++) 539 for (i = 0; i < argc_out; i++)
548 { 540 {
549 fail_if( 0 != strcmp(argv_in[i], argv_out[i]) ); 541 fail_if( 0 != strcmp(argv_in[i], argv_out[i]) );
550 } 542 }
551 543
552 ret = ecore_shutdown(); 544 ret = ecore_shutdown();
553 fail_if(ret != 0);
554} 545}
555END_TEST 546END_TEST
556 547
@@ -580,7 +571,7 @@ START_TEST(ecore_test_ecore_main_loop_poller)
580 Eina_Bool did = EINA_FALSE; 571 Eina_Bool did = EINA_FALSE;
581 572
582 ret = ecore_init(); 573 ret = ecore_init();
583 fail_if(ret != 1); 574 fail_if(ret < 1);
584 575
585 /* Check ECORE_POLLER_CORE poll interval */ 576 /* Check ECORE_POLLER_CORE poll interval */
586 double interval = 1.0; 577 double interval = 1.0;
@@ -616,7 +607,6 @@ START_TEST(ecore_test_ecore_main_loop_poller)
616 fail_if(did == EINA_FALSE); 607 fail_if(did == EINA_FALSE);
617 608
618 ret = ecore_shutdown(); 609 ret = ecore_shutdown();
619 fail_if(ret != 0);
620} 610}
621END_TEST 611END_TEST
622 612
@@ -660,7 +650,7 @@ START_TEST(ecore_test_ecore_main_loop_poller_add_del)
660 Eina_Bool did = EINA_FALSE; 650 Eina_Bool did = EINA_FALSE;
661 651
662 ret = ecore_init(); 652 ret = ecore_init();
663 fail_if(ret != 1); 653 fail_if(ret < 1);
664 654
665 /* Create renewable main poller */ 655 /* Create renewable main poller */
666 Ecore_Poller *poll_ptr = ecore_poller_add(ECORE_POLLER_CORE, 1, _poller_loop, &count_res); 656 Ecore_Poller *poll_ptr = ecore_poller_add(ECORE_POLLER_CORE, 1, _poller_loop, &count_res);
@@ -681,7 +671,6 @@ START_TEST(ecore_test_ecore_main_loop_poller_add_del)
681 fail_if(did == EINA_FALSE); 671 fail_if(did == EINA_FALSE);
682 672
683 ret = ecore_shutdown(); 673 ret = ecore_shutdown();
684 fail_if(ret != 0);
685} 674}
686END_TEST 675END_TEST
687 676
diff --git a/src/tests/ecore/ecore_test_ecore_con.c b/src/tests/ecore/ecore_test_ecore_con.c
index 2b6a0b1366..429b9d49c8 100644
--- a/src/tests/ecore/ecore_test_ecore_con.c
+++ b/src/tests/ecore/ecore_test_ecore_con.c
@@ -179,7 +179,7 @@ START_TEST(ecore_test_ecore_con_server)
179 ret = eina_init(); 179 ret = eina_init();
180 fail_if(ret != 1); 180 fail_if(ret != 1);
181 ret = ecore_init(); 181 ret = ecore_init();
182 fail_if(ret != 1); 182 fail_if(ret < 1);
183 ret = ecore_con_init(); 183 ret = ecore_con_init();
184 fail_if(ret != 1); 184 fail_if(ret != 1);
185 185
@@ -251,9 +251,7 @@ START_TEST(ecore_test_ecore_con_server)
251 ret = ecore_con_shutdown(); 251 ret = ecore_con_shutdown();
252 fail_if(ret != 0); 252 fail_if(ret != 0);
253 ret = ecore_shutdown(); 253 ret = ecore_shutdown();
254 fail_if(ret != 0);
255 ret = eina_shutdown(); 254 ret = eina_shutdown();
256 fail_if(ret != 0);
257} 255}
258END_TEST 256END_TEST
259 257
@@ -280,7 +278,7 @@ START_TEST(ecore_test_ecore_con_dns)
280 ret = eina_init(); 278 ret = eina_init();
281 fail_if(ret != 1); 279 fail_if(ret != 1);
282 ret = ecore_init(); 280 ret = ecore_init();
283 fail_if(ret != 1); 281 fail_if(ret < 1);
284 ret = ecore_con_init(); 282 ret = ecore_con_init();
285 fail_if(ret != 1); 283 fail_if(ret != 1);
286 284
@@ -302,9 +300,7 @@ START_TEST(ecore_test_ecore_con_dns)
302 ret = ecore_con_shutdown(); 300 ret = ecore_con_shutdown();
303 fail_if(ret != 0); 301 fail_if(ret != 0);
304 ret = ecore_shutdown(); 302 ret = ecore_shutdown();
305 fail_if(ret != 0);
306 ret = eina_shutdown(); 303 ret = eina_shutdown();
307 fail_if(ret != 0);
308} 304}
309END_TEST 305END_TEST
310 306