bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=117d94d90ebb324fe6ca90482349792625c3703d

commit 117d94d90ebb324fe6ca90482349792625c3703d
Author: Marcel Hollerbach <[email protected]>
Date:   Tue Dec 4 16:14:25 2018 +0100

    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
---
 src/tests/eio/eio_model_test_monitor_add.c | 34 ++++++++++++------------------
 1 file 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)
    eina_value_free(path);
 }
 
+static Eina_Bool started_up = EINA_FALSE;
+
 static Eina_Value
 _children_get(void *data,
               const Eina_Value v,
@@ -57,7 +59,7 @@ _children_get(void *data,
         str = eina_value_to_string(path);
         fail_if(str == NULL);
 
-        if (strcmp(temp_filename, str) == 0)
+        if (started_up && strcmp(temp_filename, str) == 0)
           {
              children_deleted = EINA_TRUE;
              efl_model_child_del(filemodel, child);
@@ -66,6 +68,17 @@ _children_get(void *data,
         eina_value_free(path);
      }
 
+   if (!started_up)
+     {
+        int fd;
+
+        if ((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0)
+          {
+             close(fd);
+          }
+     }
+   started_up = EINA_TRUE;
+
    return v;
 }
 
@@ -79,21 +92,6 @@ _children_added_cb(void *d EINA_UNUSED, const Efl_Event* 
event)
    eina_future_then(future, _children_get, event->object, NULL);
 }
 
-static Eina_Value
-_create_file(void *data EINA_UNUSED,
-             const Eina_Value v,
-             const Eina_Future *dead_future EINA_UNUSED)
-{
-   int fd;
-
-   if((fd = eina_file_mkstemp("prefixXXXXXX.ext", &temp_filename)) > 0)
-     {
-        close(fd);
-     }
-
-   return v;
-}
-
 EFL_START_TEST(eio_model_test_test_monitor_add)
 {
    Eo *filemodel = NULL;
@@ -109,10 +107,6 @@ EFL_START_TEST(eio_model_test_test_monitor_add)
    efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_ADDED, 
&_children_added_cb, filemodel);
    efl_event_callback_add(filemodel, EFL_MODEL_EVENT_CHILD_REMOVED, 
&_children_removed_cb, NULL);
 
-   future = efl_model_children_slice_get(filemodel, 0, 
efl_model_children_count_get(filemodel));
-
-   eina_future_then(future, &_create_file, NULL, NULL);
-
    ecore_main_loop_begin();
 
    efl_del(filemodel);

-- 


Reply via email to