summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-05-04 12:31:18 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2018-05-04 14:39:23 +0200
commit2951473a59021e242d8c5a4ce95e98def4ce8dda (patch)
tree9dca291c586a243bc79b3fdfba763d85959878af /src/tests/eio
parentc1f5d64511b0421c0fe944b00c8a5b29879060d9 (diff)
tests: optimize eio tests
Summary: by removing the sleep() calls and reducing timeout time, tests remain as accurate while taking less than 5% of the required time to run fix T6914 Reviewers: stefan_schmidt, cedric Reviewed By: cedric Subscribers: cedric Tags: #efl Maniphest Tasks: T6914 Differential Revision: https://phab.enlightenment.org/D6047
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_monitor.c82
-rw-r--r--src/tests/eio/eio_test_sentry.c76
2 files changed, 16 insertions, 142 deletions
diff --git a/src/tests/eio/eio_test_monitor.c b/src/tests/eio/eio_test_monitor.c
index ce51d8f97f..0e774dfe0b 100644
--- a/src/tests/eio/eio_test_monitor.c
+++ b/src/tests/eio/eio_test_monitor.c
@@ -14,8 +14,8 @@
14 14
15/////////////////timeout function 15/////////////////timeout function
16 16
17#define TEST_TIMEOUT_SEC 10 17#define TEST_TIMEOUT_SEC 0.5
18#define TEST_OPERATION_DELAY 0.5 18#define TEST_OPERATION_DELAY 0.01
19 19
20static Ecore_Timer *test_timeout_timer; 20static Ecore_Timer *test_timeout_timer;
21 21
@@ -106,7 +106,10 @@ static Eina_Bool _modify_attrib_file(void *data)
106 106
107static Eina_Bool _check_event_path(void *data, void *event) 107static Eina_Bool _check_event_path(void *data, void *event)
108{ 108{
109 ck_assert_str_eq((const char*)data, ((Eio_Monitor_Event*)event)->filename); 109 const char *f = ((Eio_Monitor_Event*)event)->filename;
110 /* ignore directory creation events */
111 if (ecore_file_is_dir(f)) return ECORE_CALLBACK_RENEW;
112 ck_assert_str_eq((const char*)data, f);
110 return EINA_TRUE; 113 return EINA_TRUE;
111} 114}
112 115
@@ -142,14 +145,9 @@ EFL_START_TEST(eio_test_monitor_add_and_remove)
142 filename = eina_stringshare_printf("%s/eio_test_monitor_add_and_remove", dirname); 145 filename = eina_stringshare_printf("%s/eio_test_monitor_add_and_remove", dirname);
143 _create_directory((void*)filename); 146 _create_directory((void*)filename);
144 147
145 //sleep to avoid catching event generated by above manipulations
146 usleep(500000);
147
148 //monitor directory 148 //monitor directory
149 monitor = eio_monitor_add(filename); 149 monitor = eio_monitor_add(filename);
150 150
151 usleep(500000);
152
153 eio_monitor_del(monitor); 151 eio_monitor_del(monitor);
154 152
155 _common_shutdown(dirname); 153 _common_shutdown(dirname);
@@ -166,15 +164,10 @@ EFL_START_TEST(eio_test_monitor_add_remove_add)
166 filename = eina_stringshare_printf("%s/eio_test_monitor_add_remove_add", dirname); 164 filename = eina_stringshare_printf("%s/eio_test_monitor_add_remove_add", dirname);
167 _create_directory((void*)filename); 165 _create_directory((void*)filename);
168 166
169 //sleep to avoid catching event generated by above manipulations
170 usleep(500000);
171
172 //monitor directory 167 //monitor directory
173 monitor1 = eio_monitor_add(filename); 168 monitor1 = eio_monitor_add(filename);
174 eio_monitor_del(monitor1); 169 eio_monitor_del(monitor1);
175 170
176 usleep(500000);
177
178 monitor2 = eio_monitor_add(filename); 171 monitor2 = eio_monitor_add(filename);
179 eio_monitor_del(monitor2); 172 eio_monitor_del(monitor2);
180 173
@@ -195,13 +188,10 @@ EFL_START_TEST(eio_test_monitor_add_add_remove_remove)
195 _create_directory((void*)filename1); 188 _create_directory((void*)filename1);
196 _create_directory((void*)filename2); 189 _create_directory((void*)filename2);
197 190
198 //sleep to avoid catching event generated by above manipulations
199 usleep(500000);
200
201 //monitor directory 191 //monitor directory
202 monitor1 = eio_monitor_add(filename1); 192 monitor1 = eio_monitor_add(filename1);
203 monitor2 = eio_monitor_add(filename2); 193 monitor2 = eio_monitor_add(filename2);
204 usleep(500000); 194
205 eio_monitor_del(monitor2); 195 eio_monitor_del(monitor2);
206 eio_monitor_del(monitor1); 196 eio_monitor_del(monitor1);
207 197
@@ -227,9 +217,6 @@ EFL_START_TEST(eio_test_monitor_directory_file_created_notify)
227 217
228 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_created_notify", dirname); 218 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_created_notify", dirname);
229 219
230 //sleep to avoid catching event generated by above manipulations
231 usleep(500000);
232
233 //monitor directory 220 //monitor directory
234 eio_monitor_add(dirname); 221 eio_monitor_add(dirname);
235 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_file_created_cb, filename); 222 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_file_created_cb, filename);
@@ -284,9 +271,6 @@ EFL_START_TEST(eio_test_monitor_directory_multi_file_created_notify)
284 multi_files[1].s = eina_stringshare_printf("%s/eio_test_monitor_directory_m2file_created_notify", dirname); 271 multi_files[1].s = eina_stringshare_printf("%s/eio_test_monitor_directory_m2file_created_notify", dirname);
285 multi_files[2].s = eina_stringshare_printf("%s/eio_test_monitor_directory_m3file_created_notify", dirname); 272 multi_files[2].s = eina_stringshare_printf("%s/eio_test_monitor_directory_m3file_created_notify", dirname);
286 273
287 //sleep to avoid catching event generated by above manipulations
288 usleep(500000);
289
290 //monitor directory 274 //monitor directory
291 eio_monitor_add(dirname); 275 eio_monitor_add(dirname);
292 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_multi_file_created_cb, NULL); 276 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_multi_file_created_cb, NULL);
@@ -319,9 +303,6 @@ EFL_START_TEST(eio_test_monitor_directory_file_deleted_notify)
319 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_deleted_notify", dirname); 303 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_deleted_notify", dirname);
320 _create_file((void*)filename); 304 _create_file((void*)filename);
321 305
322 //sleep to avoid catching event generated by above manipulations
323 usleep(500000);
324
325 //monitor directory 306 //monitor directory
326 eio_monitor_add(dirname); 307 eio_monitor_add(dirname);
327 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, (Ecore_Event_Handler_Cb)_file_deleted_cb, filename); 308 ecore_event_handler_add(EIO_MONITOR_FILE_DELETED, (Ecore_Event_Handler_Cb)_file_deleted_cb, filename);
@@ -352,9 +333,6 @@ EFL_START_TEST(eio_test_monitor_directory_file_modified_notify)
352 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_modified_notify", dirname); 333 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_modified_notify", dirname);
353 _create_file((void*)filename); 334 _create_file((void*)filename);
354 335
355 //sleep to avoid catching event generated by above manipulations
356 usleep(500000);
357
358 //monitor directory 336 //monitor directory
359 eio_monitor_add(dirname); 337 eio_monitor_add(dirname);
360 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename); 338 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename);
@@ -386,9 +364,6 @@ EFL_START_TEST(eio_test_monitor_directory_file_closed_notify)
386 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_closed_notify", dirname); 364 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_file_closed_notify", dirname);
387 _create_file((void*)filename); 365 _create_file((void*)filename);
388 366
389 //sleep to avoid catching event generated by above manipulations
390 usleep(500000);
391
392 //monitor directory 367 //monitor directory
393 eio_monitor_add(dirname); 368 eio_monitor_add(dirname);
394 ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, (Ecore_Event_Handler_Cb)_file_closed_cb, filename); 369 ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, (Ecore_Event_Handler_Cb)_file_closed_cb, filename);
@@ -417,9 +392,6 @@ EFL_START_TEST(eio_test_monitor_directory_directory_created_notify)
417 392
418 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_created_notify", dirname); 393 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_created_notify", dirname);
419 394
420 //sleep to avoid catching event generated by above manipulations
421 usleep(500000);
422
423 //monitor directory 395 //monitor directory
424 eio_monitor_add(dirname); 396 eio_monitor_add(dirname);
425 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, (Ecore_Event_Handler_Cb)_directory_created_cb, filename); 397 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_CREATED, (Ecore_Event_Handler_Cb)_directory_created_cb, filename);
@@ -450,9 +422,6 @@ EFL_START_TEST(eio_test_monitor_directory_directory_deleted_notify)
450 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_deleted_notify", dirname); 422 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_deleted_notify", dirname);
451 _create_directory((void*)filename); 423 _create_directory((void*)filename);
452 424
453 //sleep to avoid catching event generated by above manipulations
454 usleep(500000);
455
456 //monitor directory 425 //monitor directory
457 eio_monitor_add(dirname); 426 eio_monitor_add(dirname);
458 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, (Ecore_Event_Handler_Cb)_directory_deleted_cb, filename); 427 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED, (Ecore_Event_Handler_Cb)_directory_deleted_cb, filename);
@@ -484,9 +453,6 @@ EFL_START_TEST(eio_test_monitor_directory_directory_modified_notify)
484 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_modified_notify", dirname); 453 filename = eina_stringshare_printf("%s/eio_test_monitor_directory_directory_modified_notify", dirname);
485 _create_directory((void*)filename); 454 _create_directory((void*)filename);
486 455
487 //sleep to avoid catching event generated by above manipulations
488 usleep(500000);
489
490 //monitor directory 456 //monitor directory
491 eio_monitor_add(dirname); 457 eio_monitor_add(dirname);
492 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, (Ecore_Event_Handler_Cb)_directory_modified_cb, filename); 458 ecore_event_handler_add(EIO_MONITOR_DIRECTORY_MODIFIED, (Ecore_Event_Handler_Cb)_directory_modified_cb, filename);
@@ -515,9 +481,6 @@ EFL_START_TEST(eio_test_monitor_directory_directory_self_deleted_notify)
515{ 481{
516 Eina_Tmpstr *dirname = _common_init(); 482 Eina_Tmpstr *dirname = _common_init();
517 483
518 //sleep to avoid catching event generated by above manipulations
519 usleep(500000);
520
521 //monitor directory 484 //monitor directory
522 eio_monitor_add(dirname); 485 eio_monitor_add(dirname);
523 ecore_event_handler_add(EIO_MONITOR_SELF_DELETED, (Ecore_Event_Handler_Cb)_directory_self_deleted_cb, dirname); 486 ecore_event_handler_add(EIO_MONITOR_SELF_DELETED, (Ecore_Event_Handler_Cb)_directory_self_deleted_cb, dirname);
@@ -540,9 +503,6 @@ EFL_START_TEST(eio_test_monitor_file_file_modified_notify)
540 filename = eina_stringshare_printf("%s/filecreated", dirname); 503 filename = eina_stringshare_printf("%s/filecreated", dirname);
541 _create_file((void*)filename); 504 _create_file((void*)filename);
542 505
543 //sleep to avoid catching event generated by above manipulations
544 usleep(500000);
545
546 //monitor file 506 //monitor file
547 eio_monitor_add(filename); 507 eio_monitor_add(filename);
548 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename); 508 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename);
@@ -564,9 +524,6 @@ EFL_START_TEST(eio_test_monitor_file_file_attrib_modified_notify)
564 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_attrib_modified_notify", dirname); 524 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_attrib_modified_notify", dirname);
565 _create_file((void*)filename); 525 _create_file((void*)filename);
566 526
567 //sleep to avoid catching event generated by above manipulations
568 usleep(500000);
569
570 //monitor file 527 //monitor file
571 eio_monitor_add(filename); 528 eio_monitor_add(filename);
572 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename); 529 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_file_modified_cb, filename);
@@ -588,9 +545,6 @@ EFL_START_TEST(eio_test_monitor_file_file_closed_notify)
588 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_closed_notify", dirname); 545 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_closed_notify", dirname);
589 _create_file((void*)filename); 546 _create_file((void*)filename);
590 547
591 //sleep to avoid catching event generated by above manipulations
592 usleep(500000);
593
594 //monitor file 548 //monitor file
595 eio_monitor_add(dirname); 549 eio_monitor_add(dirname);
596 ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, (Ecore_Event_Handler_Cb)_file_closed_cb, filename); 550 ecore_event_handler_add(EIO_MONITOR_FILE_CLOSED, (Ecore_Event_Handler_Cb)_file_closed_cb, filename);
@@ -610,9 +564,6 @@ EFL_START_TEST(eio_test_monitor_file_file_self_deleted_notify)
610 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_self_deleted_notify", dirname); 564 filename = eina_stringshare_printf("%s/eio_test_monitor_file_file_self_deleted_notify", dirname);
611 _create_file((void*)filename); 565 _create_file((void*)filename);
612 566
613 //sleep to avoid catching event generated by above manipulations
614 usleep(500000);
615
616 //monitor file 567 //monitor file
617 eio_monitor_add(filename); 568 eio_monitor_add(filename);
618 ecore_event_handler_add(EIO_MONITOR_SELF_DELETED, (Ecore_Event_Handler_Cb)_directory_self_deleted_cb, filename); 569 ecore_event_handler_add(EIO_MONITOR_SELF_DELETED, (Ecore_Event_Handler_Cb)_directory_self_deleted_cb, filename);
@@ -635,9 +586,6 @@ EFL_START_TEST(eio_test_monitor_two_monitors_one_event)
635 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2); 586 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2);
636 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_event", dirname); 587 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_event", dirname);
637 588
638 //sleep to avoid catching event generated by above manipulations
639 usleep(500000);
640
641 //monitor directory 589 //monitor directory
642 eio_monitor_add(dirname); 590 eio_monitor_add(dirname);
643 eio_monitor_add(dirname2); 591 eio_monitor_add(dirname2);
@@ -665,9 +613,6 @@ EFL_START_TEST(eio_test_monitor_two_monitors_one_removed_one_event)
665 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2); 613 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2);
666 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_removed", dirname); 614 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_removed", dirname);
667 615
668 //sleep to avoid catching event generated by above manipulations
669 usleep(500000);
670
671 //monitor directory 616 //monitor directory
672 monitor = eio_monitor_add(dirname2); 617 monitor = eio_monitor_add(dirname2);
673 eio_monitor_add(dirname); 618 eio_monitor_add(dirname);
@@ -700,9 +645,6 @@ EFL_START_TEST(eio_test_monitor_two_monitors_one_removed_no_event)
700 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2); 645 eina_file_mkdtemp("checkFileCreationXXXXXX", &dirname2);
701 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_removed", dirname); 646 filename = eina_stringshare_printf("%s/eio_test_monitor_two_monitors_one_removed", dirname);
702 647
703 //sleep to avoid catching event generated by above manipulations
704 usleep(500000);
705
706 //monitor directory 648 //monitor directory
707 monitor = eio_monitor_add(dirname); 649 monitor = eio_monitor_add(dirname);
708 eio_monitor_add(dirname2); 650 eio_monitor_add(dirname2);
@@ -710,7 +652,7 @@ EFL_START_TEST(eio_test_monitor_two_monitors_one_removed_no_event)
710 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_unexpected_event_cb, filename); 652 ecore_event_handler_add(EIO_MONITOR_FILE_CREATED, (Ecore_Event_Handler_Cb)_unexpected_event_cb, filename);
711 653
712 ecore_timer_add(TEST_OPERATION_DELAY, _create_file, filename); 654 ecore_timer_add(TEST_OPERATION_DELAY, _create_file, filename);
713 ecore_timer_add(TEST_TIMEOUT_SEC - 1, _test_timeout_expected, NULL); 655 ecore_timer_add(0.2, _test_timeout_expected, NULL);
714 656
715 ecore_main_loop_begin(); 657 ecore_main_loop_begin();
716 658
@@ -730,9 +672,6 @@ EFL_START_TEST(eio_test_monitor_two_files_in_same_directory)
730 _create_file((void*)filename); 672 _create_file((void*)filename);
731 _create_file((void*)filename2); 673 _create_file((void*)filename2);
732 674
733 //sleep to avoid catching event generated by above manipulations
734 usleep(500000);
735
736 //monitor file 675 //monitor file
737 eio_monitor_add(filename); 676 eio_monitor_add(filename);
738 eio_monitor_add(filename2); 677 eio_monitor_add(filename2);
@@ -760,9 +699,6 @@ EFL_START_TEST(eio_test_monitor_two_files_in_same_directory_one_removed)
760 _create_file((void*)filename); 699 _create_file((void*)filename);
761 _create_file((void*)filename2); 700 _create_file((void*)filename2);
762 701
763 //sleep to avoid catching event generated by above manipulations
764 usleep(500000);
765
766 //monitor file 702 //monitor file
767 monitor = eio_monitor_add(filename); 703 monitor = eio_monitor_add(filename);
768 eio_monitor_add(filename2); 704 eio_monitor_add(filename2);
@@ -771,7 +707,7 @@ EFL_START_TEST(eio_test_monitor_two_files_in_same_directory_one_removed)
771 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_unexpected_event_cb, filename); 707 ecore_event_handler_add(EIO_MONITOR_FILE_MODIFIED, (Ecore_Event_Handler_Cb)_unexpected_event_cb, filename);
772 708
773 ecore_timer_add(TEST_OPERATION_DELAY, _modify_file, filename); 709 ecore_timer_add(TEST_OPERATION_DELAY, _modify_file, filename);
774 ecore_timer_add(TEST_TIMEOUT_SEC - 1, _test_timeout_expected, NULL); 710 ecore_timer_add(0.2, _test_timeout_expected, NULL);
775 711
776 ecore_main_loop_begin(); 712 ecore_main_loop_begin();
777 713
diff --git a/src/tests/eio/eio_test_sentry.c b/src/tests/eio/eio_test_sentry.c
index f76d2824f5..d2a368438c 100644
--- a/src/tests/eio/eio_test_sentry.c
+++ b/src/tests/eio/eio_test_sentry.c
@@ -14,8 +14,8 @@
14 14
15/////////////////timeout function 15/////////////////timeout function
16 16
17#define TEST_TIMEOUT_SEC 10 17#define TEST_TIMEOUT_SEC 0.5
18#define TEST_OPERATION_DELAY 0.5 18#define TEST_OPERATION_DELAY 0.01
19 19
20static Ecore_Timer *test_timeout_timer; 20static Ecore_Timer *test_timeout_timer;
21 21
@@ -107,6 +107,8 @@ static Eina_Bool _modify_attrib_file(void *data)
107static void _check_event_path(void *data, const Efl_Event *event) 107static void _check_event_path(void *data, const Efl_Event *event)
108{ 108{
109 Eio_Sentry_Event *event_info = event->info; 109 Eio_Sentry_Event *event_info = event->info;
110 /* ignore directory creation events */
111 if (ecore_file_is_dir(event_info->trigger)) return;
110 ck_assert_str_eq((const char*)data, event_info->trigger); 112 ck_assert_str_eq((const char*)data, event_info->trigger);
111} 113}
112 114
@@ -142,15 +144,10 @@ EFL_START_TEST(eio_test_sentry_add_and_remove)
142 filename = eina_stringshare_printf("%s/eio_test_sentry_add_and_remove", dirname); 144 filename = eina_stringshare_printf("%s/eio_test_sentry_add_and_remove", dirname);
143 _create_directory((void*)filename); 145 _create_directory((void*)filename);
144 146
145 //sleep to avoid catching event generated by above manipulations
146 usleep(500000);
147
148 //monitor directory 147 //monitor directory
149 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 148 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
150 fail_if(!eio_sentry_add(sentry, filename)); 149 fail_if(!eio_sentry_add(sentry, filename));
151 150
152 usleep(500000);
153
154 eio_sentry_remove(sentry, filename); 151 eio_sentry_remove(sentry, filename);
155 152
156 efl_unref(sentry); 153 efl_unref(sentry);
@@ -168,16 +165,11 @@ EFL_START_TEST(eio_test_sentry_add_remove_add)
168 filename = eina_stringshare_printf("%s/eio_test_sentry_add_remove_add", dirname); 165 filename = eina_stringshare_printf("%s/eio_test_sentry_add_remove_add", dirname);
169 _create_directory((void*)filename); 166 _create_directory((void*)filename);
170 167
171 //sleep to avoid catching event generated by above manipulations
172 usleep(500000);
173
174 //monitor directory 168 //monitor directory
175 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 169 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
176 fail_if(!eio_sentry_add(sentry, filename)); 170 fail_if(!eio_sentry_add(sentry, filename));
177 eio_sentry_remove(sentry, filename); 171 eio_sentry_remove(sentry, filename);
178 172
179 usleep(500000);
180
181 fail_if(!eio_sentry_add(sentry, filename)); 173 fail_if(!eio_sentry_add(sentry, filename));
182 eio_sentry_remove(sentry, filename); 174 eio_sentry_remove(sentry, filename);
183 175
@@ -199,15 +191,12 @@ EFL_START_TEST(eio_test_sentry_add_add_remove_remove)
199 _create_directory((void*)filename1); 191 _create_directory((void*)filename1);
200 _create_directory((void*)filename2); 192 _create_directory((void*)filename2);
201 193
202 //sleep to avoid catching event generated by above manipulations
203 usleep(500000);
204
205 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 194 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
206 195
207 //monitor directory 196 //monitor directory
208 fail_if(!eio_sentry_add(sentry, filename1)); 197 fail_if(!eio_sentry_add(sentry, filename1));
209 fail_if(!eio_sentry_add(sentry, filename2)); 198 fail_if(!eio_sentry_add(sentry, filename2));
210 usleep(500000); 199
211 eio_sentry_remove(sentry, filename1); 200 eio_sentry_remove(sentry, filename1);
212 eio_sentry_remove(sentry, filename2); 201 eio_sentry_remove(sentry, filename2);
213 202
@@ -234,9 +223,6 @@ EFL_START_TEST(eio_test_sentry_directory_file_created_notify)
234 filename = eina_stringshare_printf("%s/eio_test_sentry_directory_file_created_notify", dirname); 223 filename = eina_stringshare_printf("%s/eio_test_sentry_directory_file_created_notify", dirname);
235 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 224 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
236 225
237 //sleep to avoid catching event generated by above manipulations
238 usleep(500000);
239
240 //monitor directory 226 //monitor directory
241 fail_if(!eio_sentry_add(sentry, dirname)); 227 fail_if(!eio_sentry_add(sentry, dirname));
242 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CREATED, (Efl_Event_Cb)_target_notified_cb, filename); 228 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CREATED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -261,9 +247,6 @@ EFL_START_TEST(eio_test_sentry_directory_file_deleted_notify)
261 _create_file((void*)filename); 247 _create_file((void*)filename);
262 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 248 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
263 249
264 //sleep to avoid catching event generated by above manipulations
265 usleep(500000);
266
267 //monitor directory 250 //monitor directory
268 fail_if(!eio_sentry_add(sentry, dirname)); 251 fail_if(!eio_sentry_add(sentry, dirname));
269 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_DELETED, (Efl_Event_Cb)_target_notified_cb, filename); 252 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_DELETED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -288,9 +271,6 @@ EFL_START_TEST(eio_test_sentry_directory_file_modified_notify)
288 _create_file((void*)filename); 271 _create_file((void*)filename);
289 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 272 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
290 273
291 //sleep to avoid catching event generated by above manipulations
292 usleep(500000);
293
294 //monitor directory 274 //monitor directory
295 fail_if(!eio_sentry_add(sentry, dirname)); 275 fail_if(!eio_sentry_add(sentry, dirname));
296 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename); 276 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -316,9 +296,6 @@ EFL_START_TEST(eio_test_sentry_directory_file_closed_notify)
316 _create_file((void*)filename); 296 _create_file((void*)filename);
317 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 297 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
318 298
319 //sleep to avoid catching event generated by above manipulations
320 usleep(500000);
321
322 //monitor directory 299 //monitor directory
323 fail_if(!eio_sentry_add(sentry, dirname)); 300 fail_if(!eio_sentry_add(sentry, dirname));
324 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CLOSED, (Efl_Event_Cb)_target_notified_cb, filename); 301 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CLOSED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -341,9 +318,6 @@ EFL_START_TEST(eio_test_sentry_directory_directory_created_notify)
341 filename = eina_stringshare_printf("%s/eio_test_sentry_directory_directory_created_notify", dirname); 318 filename = eina_stringshare_printf("%s/eio_test_sentry_directory_directory_created_notify", dirname);
342 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 319 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
343 320
344 //sleep to avoid catching event generated by above manipulations
345 usleep(500000);
346
347 //monitor directory 321 //monitor directory
348 fail_if(!eio_sentry_add(sentry, dirname)); 322 fail_if(!eio_sentry_add(sentry, dirname));
349 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_CREATED, (Efl_Event_Cb)_target_notified_cb, filename); 323 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_CREATED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -368,9 +342,6 @@ EFL_START_TEST(eio_test_sentry_directory_directory_deleted_notify)
368 _create_directory((void*)filename); 342 _create_directory((void*)filename);
369 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 343 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
370 344
371 //sleep to avoid catching event generated by above manipulations
372 usleep(500000);
373
374 //monitor directory 345 //monitor directory
375 fail_if(!eio_sentry_add(sentry, dirname)); 346 fail_if(!eio_sentry_add(sentry, dirname));
376 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_DELETED, (Efl_Event_Cb)_target_notified_cb, filename); 347 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_DELETED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -395,9 +366,6 @@ EFL_START_TEST(eio_test_sentry_directory_directory_modified_notify)
395 _create_directory((void*)filename); 366 _create_directory((void*)filename);
396 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 367 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
397 368
398 //sleep to avoid catching event generated by above manipulations
399 usleep(500000);
400
401 //monitor directory 369 //monitor directory
402 fail_if(!eio_sentry_add(sentry, dirname)); 370 fail_if(!eio_sentry_add(sentry, dirname));
403 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename); 371 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_DIRECTORY_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -417,9 +385,6 @@ EFL_START_TEST(eio_test_sentry_directory_directory_self_deleted_notify)
417 Eina_Tmpstr *dirname = _common_init(); 385 Eina_Tmpstr *dirname = _common_init();
418 Eo *sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 386 Eo *sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
419 387
420 //sleep to avoid catching event generated by above manipulations
421 usleep(500000);
422
423 //monitor directory 388 //monitor directory
424 fail_if(!eio_sentry_add(sentry, dirname)); 389 fail_if(!eio_sentry_add(sentry, dirname));
425 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_SELF_DELETED, (Efl_Event_Cb)_target_notified_cb, dirname); 390 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_SELF_DELETED, (Efl_Event_Cb)_target_notified_cb, dirname);
@@ -446,9 +411,6 @@ EFL_START_TEST(eio_test_sentry_file_file_modified_notify)
446 _create_file((void*)filename); 411 _create_file((void*)filename);
447 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 412 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
448 413
449 //sleep to avoid catching event generated by above manipulations
450 usleep(500000);
451
452 //monitor file 414 //monitor file
453 fail_if(!eio_sentry_add(sentry, filename)); 415 fail_if(!eio_sentry_add(sentry, filename));
454 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename); 416 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -474,9 +436,6 @@ EFL_START_TEST(eio_test_sentry_file_file_attrib_modified_notify)
474 _create_file((void*)filename); 436 _create_file((void*)filename);
475 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 437 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
476 438
477 //sleep to avoid catching event generated by above manipulations
478 usleep(500000);
479
480 //monitor file 439 //monitor file
481 fail_if(!eio_sentry_add(sentry, filename)); 440 fail_if(!eio_sentry_add(sentry, filename));
482 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename); 441 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -502,9 +461,6 @@ EFL_START_TEST(eio_test_sentry_file_file_closed_notify)
502 _create_file((void*)filename); 461 _create_file((void*)filename);
503 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 462 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
504 463
505 //sleep to avoid catching event generated by above manipulations
506 usleep(500000);
507
508 //monitor file 464 //monitor file
509 fail_if(!eio_sentry_add(sentry, dirname)); 465 fail_if(!eio_sentry_add(sentry, dirname));
510 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CLOSED, (Efl_Event_Cb)_target_notified_cb, filename); 466 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CLOSED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -528,9 +484,6 @@ EFL_START_TEST(eio_test_sentry_file_file_self_deleted_notify)
528 _create_file((void*)filename); 484 _create_file((void*)filename);
529 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 485 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
530 486
531 //sleep to avoid catching event generated by above manipulations
532 usleep(500000);
533
534 //monitor file 487 //monitor file
535 fail_if(!eio_sentry_add(sentry, filename)); 488 fail_if(!eio_sentry_add(sentry, filename));
536 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_SELF_DELETED, (Efl_Event_Cb)_target_notified_cb, filename); 489 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_SELF_DELETED, (Efl_Event_Cb)_target_notified_cb, filename);
@@ -557,9 +510,6 @@ EFL_START_TEST(eio_test_sentry_two_monitors_one_event)
557 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_event", dirname); 510 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_event", dirname);
558 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 511 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
559 512
560 //sleep to avoid catching event generated by above manipulations
561 usleep(500000);
562
563 //monitor directory 513 //monitor directory
564 fail_if(!eio_sentry_add(sentry, dirname)); 514 fail_if(!eio_sentry_add(sentry, dirname));
565 fail_if(!eio_sentry_add(sentry, dirname2)); 515 fail_if(!eio_sentry_add(sentry, dirname2));
@@ -589,9 +539,6 @@ EFL_START_TEST(eio_test_sentry_two_monitors_one_removed_one_event)
589 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_removed", dirname); 539 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_removed", dirname);
590 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 540 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
591 541
592 //sleep to avoid catching event generated by above manipulations
593 usleep(500000);
594
595 //monitor directory 542 //monitor directory
596 fail_if(!eio_sentry_add(sentry, dirname2)); 543 fail_if(!eio_sentry_add(sentry, dirname2));
597 fail_if(!eio_sentry_add(sentry, dirname)); 544 fail_if(!eio_sentry_add(sentry, dirname));
@@ -626,9 +573,6 @@ EFL_START_TEST(eio_test_sentry_two_monitors_one_removed_no_event)
626 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_removed", dirname); 573 filename = eina_stringshare_printf("%s/eio_test_sentry_two_monitors_one_removed", dirname);
627 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 574 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
628 575
629 //sleep to avoid catching event generated by above manipulations
630 usleep(500000);
631
632 //monitor directory 576 //monitor directory
633 fail_if(!eio_sentry_add(sentry, dirname)); 577 fail_if(!eio_sentry_add(sentry, dirname));
634 fail_if(!eio_sentry_add(sentry, dirname2)); 578 fail_if(!eio_sentry_add(sentry, dirname2));
@@ -636,7 +580,7 @@ EFL_START_TEST(eio_test_sentry_two_monitors_one_removed_no_event)
636 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CREATED, (Efl_Event_Cb)_unexpected_event_cb, filename); 580 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_CREATED, (Efl_Event_Cb)_unexpected_event_cb, filename);
637 581
638 ecore_timer_add(TEST_OPERATION_DELAY, _create_file, filename); 582 ecore_timer_add(TEST_OPERATION_DELAY, _create_file, filename);
639 ecore_timer_add(TEST_TIMEOUT_SEC - 1, _test_timeout_expected, NULL); 583 ecore_timer_add(0.2, _test_timeout_expected, NULL);
640 584
641 ecore_main_loop_begin(); 585 ecore_main_loop_begin();
642 586
@@ -660,9 +604,6 @@ EFL_START_TEST(eio_test_sentry_two_files_in_same_directory)
660 _create_file((void*)filename2); 604 _create_file((void*)filename2);
661 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 605 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
662 606
663 //sleep to avoid catching event generated by above manipulations
664 usleep(500000);
665
666 //monitor file 607 //monitor file
667 fail_if(!eio_sentry_add(sentry,filename)); 608 fail_if(!eio_sentry_add(sentry,filename));
668 fail_if(!eio_sentry_add(sentry,filename2)); 609 fail_if(!eio_sentry_add(sentry,filename2));
@@ -693,9 +634,6 @@ EFL_START_TEST(eio_test_sentry_two_files_in_same_directory_one_removed)
693 _create_file((void*)filename2); 634 _create_file((void*)filename2);
694 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get()); 635 sentry = efl_add(EIO_SENTRY_CLASS, efl_main_loop_get());
695 636
696 //sleep to avoid catching event generated by above manipulations
697 usleep(500000);
698
699 //monitor file 637 //monitor file
700 fail_if(!eio_sentry_add(sentry,filename)); 638 fail_if(!eio_sentry_add(sentry,filename));
701 fail_if(!eio_sentry_add(sentry,filename2)); 639 fail_if(!eio_sentry_add(sentry,filename2));
@@ -704,7 +642,7 @@ EFL_START_TEST(eio_test_sentry_two_files_in_same_directory_one_removed)
704 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_unexpected_event_cb, filename); 642 efl_event_callback_add(sentry, EIO_SENTRY_EVENT_FILE_MODIFIED, (Efl_Event_Cb)_unexpected_event_cb, filename);
705 643
706 ecore_timer_add(TEST_OPERATION_DELAY, _modify_file, filename); 644 ecore_timer_add(TEST_OPERATION_DELAY, _modify_file, filename);
707 ecore_timer_add(TEST_TIMEOUT_SEC - 1, _test_timeout_expected, NULL); 645 ecore_timer_add(0.2, _test_timeout_expected, NULL);
708 646
709 ecore_main_loop_begin(); 647 ecore_main_loop_begin();
710 648