summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-04 16:14:25 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-12-20 14:05:58 +0100
commit117d94d90ebb324fe6ca90482349792625c3703d (patch)
treeeba01aaafca0a4ab326a750ec53b219ebc253487 /src/tests/eio
parente15d696372a8f64a9c7cfa67f155e3d2b98494dd (diff)
eio-tests: fix deadlocking of the testsuite
what happens was is that efl_model_children_count_get trigger the monitoring to start. However, that means that *sometimes* the created file in this test was sometimes called in a ADDED event due to the listing of files, and sometimes due to the event of a newly added file. The problem here is that when the ADDED event is added due to the file listing and not the monitoring, then there *could* be a ADDED event and the deletion of the file will not trigger a REMOVED event. Which is a bug. However, up to this point it is not fully clear to me if this is solvable with this setup of monitoring or not. So this test is changed to not trigger this deadlock anymore, the idea of the test is still tested, just in another way. ref T7478 Differential Revision: https://phab.enlightenment.org/D7412
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_model_test_monitor_add.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/tests/eio/eio_model_test_monitor_add.c b/src/tests/eio/eio_model_test_monitor_add.c
index aeaaad0229..b93ee1c7ad 100644
--- a/src/tests/eio/eio_model_test_monitor_add.c
+++ b/src/tests/eio/eio_model_test_monitor_add.c
@@ -36,6 +36,8 @@ _children_removed_cb(void *data EINA_UNUSED, const Efl_Event* event)
36 eina_value_free(path); 36 eina_value_free(path);
37} 37}
38 38
39static Eina_Bool started_up = EINA_FALSE;
40
39static Eina_Value 41static Eina_Value
40_children_get(void *data, 42_children_get(void *data,
41 const Eina_Value v, 43 const Eina_Value v,
@@ -57,7 +59,7 @@ _children_get(void *data,
57 str = eina_value_to_string(path); 59 str = eina_value_to_string(path);
58 fail_if(str == NULL); 60 fail_if(str == NULL);
59 61
60 if (strcmp(temp_filename, str) == 0) 62 if (started_up && strcmp(temp_filename, str) == 0)
61 { 63 {
62 children_deleted = EINA_TRUE; 64 children_deleted = EINA_TRUE;
63 efl_model_child_del(filemodel, child); 65 efl_model_child_del(filemodel, child);
@@ -66,6 +68,17 @@ _children_get(void *data,
66 eina_value_free(path); 68 eina_value_free(path);
67 } 69 }
68 70
71 if (!started_up)
72 {
73 int fd;
74
75 if ((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0)
76 {
77 close(fd);
78 }
79 }
80 started_up = EINA_TRUE;
81
69 return v; 82 return v;
70} 83}
71 84
@@ -79,21 +92,6 @@ _children_added_cb(void *d EINA_UNUSED, const Efl_Event* event)
79 eina_future_then(future, _children_get, event->object, NULL); 92 eina_future_then(future, _children_get, event->object, NULL);
80} 93}
81 94
82static Eina_Value
83_create_file(void *data EINA_UNUSED,
84 const Eina_Value v,
85 const Eina_Future *dead_future EINA_UNUSED)
86{
87 int fd;
88
89 if((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0)
90 {
91 close(fd);
92 }
93
94 return v;
95}
96
97EFL_START_TEST(eio_model_test_test_monitor_add) 95EFL_START_TEST(eio_model_test_test_monitor_add)
98{ 96{
99 Eo *filemodel = NULL; 97 Eo *filemodel = NULL;
@@ -109,10 +107,6 @@ EFL_START_TEST(eio_model_test_test_monitor_add)
109 efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_ADDED, &_children_added_cb, filemodel); 107 efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_ADDED, &_children_added_cb, filemodel);
110 efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_REMOVED, &_children_removed_cb, NULL); 108 efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_REMOVED, &_children_removed_cb, NULL);
111 109
112 future = efl_model_children_slice_get(filemodel, 0, efl_model_children_count_get(filemodel));
113
114 eina_future_then(future, &_create_file, NULL, NULL);
115
116 ecore_main_loop_begin(); 110 ecore_main_loop_begin();
117 111
118 efl_del(filemodel); 112 efl_del(filemodel);