summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-27 16:32:58 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-27 16:32:58 -0700
commit245ea06a6565d0261564652a26a9310420e48740 (patch)
tree20760c2df544358b4217b35081ff0ccafc82b349 /src/tests/eio
parent3a3ae49afde1712f4f972d8f3dc4b2feaa5579c7 (diff)
eio: convert Efl.Io.Manager.stat() to return Eina_Future.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_manager.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/tests/eio/eio_test_manager.c b/src/tests/eio/eio_test_manager.c
index e97310276c..8224af207a 100644
--- a/src/tests/eio/eio_test_manager.c
+++ b/src/tests/eio/eio_test_manager.c
@@ -75,19 +75,37 @@ _open_done_cb(void *data,
75 return file; 75 return file;
76} 76}
77 77
78static void 78static Eina_Value
79_stat_done_cb(void *data, const Efl_Event *ev) 79_stat_done_cb(void *data,
80 const Eina_Value st,
81 const Eina_Future *dead EINA_UNUSED)
80{ 82{
81 Efl_Future_Event_Success *success = ev->info;
82 Eina_Stat const* stat = success->value;
83 Eina_Bool *is_dir = data; 83 Eina_Bool *is_dir = data;
84 unsigned int rights; 84 unsigned int rights;
85 85
86 fail_if(eio_file_is_dir(stat) != *is_dir); 86 if (st.type == EINA_VALUE_TYPE_ERROR)
87 fail_if(eio_file_is_lnk(stat)); 87 {
88 rights = stat->mode & (S_IRWXU | S_IRWXG | S_IRWXO); 88 Eina_Error err;
89 fail_if(rights != default_rights); 89 eina_value_get(&st, &err);
90 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
91 abort();
92 }
93
94 if (st.type == EINA_VALUE_TYPE_STRUCT)
95 {
96 unsigned int mode = 0;
97
98 fail_if(!eina_value_struct_get(&st, "mode", &mode));
99 fail_if(S_ISDIR(mode) != *is_dir);
100 fail_if(S_ISLNK(mode));
101
102 rights = mode & (S_IRWXU | S_IRWXG | S_IRWXO);
103 fail_if(rights != default_rights);
104 }
105
90 ecore_main_loop_quit(); 106 ecore_main_loop_quit();
107
108 return st;
91} 109}
92 110
93static void 111static void
@@ -128,7 +146,7 @@ START_TEST(efl_io_manager_test_stat)
128 Eina_Tmpstr *nested_dirname; 146 Eina_Tmpstr *nested_dirname;
129 Eina_Tmpstr *nested_filename; 147 Eina_Tmpstr *nested_filename;
130 Efl_Io_Manager *job; 148 Efl_Io_Manager *job;
131 Efl_Future *f; 149 Eina_Future *f;
132 Eina_Bool is_dir = EINA_TRUE; 150 Eina_Bool is_dir = EINA_TRUE;
133 int ret; 151 int ret;
134 152
@@ -150,12 +168,12 @@ START_TEST(efl_io_manager_test_stat)
150 168
151 // Start testing 169 // Start testing
152 f = efl_io_manager_stat(job, nested_dirname); 170 f = efl_io_manager_stat(job, nested_dirname);
153 efl_future_then(f, &_stat_done_cb, &_error_cb, NULL, &is_dir); 171 eina_future_then(f, _stat_done_cb, &is_dir);
154 ecore_main_loop_begin(); 172 ecore_main_loop_begin();
155 173
156 is_dir = EINA_FALSE; 174 is_dir = EINA_FALSE;
157 f = efl_io_manager_stat(job, nested_filename); 175 f = efl_io_manager_stat(job, nested_filename);
158 efl_future_then(f, &_stat_done_cb, &_error_cb, NULL, &is_dir); 176 eina_future_then(f, _stat_done_cb, &is_dir);
159 ecore_main_loop_begin(); 177 ecore_main_loop_begin();
160 178
161 // Cleanup 179 // Cleanup