summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-08-26 16:52:11 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-08 15:16:42 -0700
commit8e8c50e7a187ecef73c20e0e368351e7751100f9 (patch)
tree97a12c893083b50a9eecc417a7c366ed949a4140 /src/tests/eio
parent52c63190d5b9906698b5e1872ce6448185218d91 (diff)
eio: fix manager tests.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_manager.c220
-rw-r--r--src/tests/eio/eio_test_manager_xattr.c96
2 files changed, 148 insertions, 168 deletions
diff --git a/src/tests/eio/eio_test_manager.c b/src/tests/eio/eio_test_manager.c
index cdf0644663..c20530e109 100644
--- a/src/tests/eio/eio_test_manager.c
+++ b/src/tests/eio/eio_test_manager.c
@@ -13,87 +13,64 @@
13# define O_BINARY 0 13# define O_BINARY 0
14#endif 14#endif
15 15
16static int test_count = 0; 16static uint64_t test_count = 0;
17static Eina_Bool direct = EINA_FALSE;
17 18
18static int DONE_CALLED = 0xdeadbeef; 19#define DONE_CALLED 0xdeadbeef
19 20
20static void 21static void
21_filter_direct_cb(void *data EINA_UNUSED, const Efl_Event *event) 22_progress_cb(void *data, const Efl_Event *ev)
22{ 23{
23 Eio_Filter_Direct_Data *event_info = event->info; 24 Efl_Future_Event_Progress *p = ev->info;
24 char *last_slash = strrchr(event_info->info->path, '/'); 25 Eina_Array *batch = p->progress;
25 26 uint64_t *number_of_listed_files = data;
26 //Check if it is a hidden file
27 if (last_slash != NULL && strlen(last_slash) > 1 && last_slash[1] == '.')
28 event_info->filter = EINA_FALSE;
29 else
30 event_info->filter = EINA_TRUE;
31}
32
33static void
34_main_direct_cb(void *data, const Eina_File_Direct_Info *info)
35{
36 int *number_of_listed_files = (int *)data;
37 27
38 fprintf(stderr, "Processing file:%s\n", info->path); 28 (*number_of_listed_files) += eina_array_count(batch);
39 (*number_of_listed_files)++;
40}
41
42static void
43_filter_cb(void *data EINA_UNUSED, const Efl_Event *event)
44{
45 Eio_Filter_Name_Data *event_info = event->info;
46 char *last_slash = strrchr(event_info->file, '/');
47
48 //Check if it is a hidden file
49 if (last_slash != NULL && strlen(last_slash) > 1 && last_slash[1] == '.')
50 event_info->filter = EINA_FALSE;
51 else
52 event_info->filter = EINA_TRUE;
53} 29}
54 30
55static void 31static void
56_main_cb(void *data, const char *file) 32_done_cb(void *data, const Efl_Event *ev)
57{ 33{
58 int *number_of_listed_files = (int *)data; 34 Efl_Future_Event_Success *success = ev->info;
35 uint64_t *files_count = success->value;
36 uint64_t *number_of_listed_files = data;
59 37
60 fprintf(stderr, "Processing file:%s\n", file);
61 (*number_of_listed_files)++;
62}
63
64static void
65_done_cb(void *data, void* value EINA_UNUSED)
66{
67 int *number_of_listed_files = (int *)data;
68 fail_if((*number_of_listed_files) != test_count); 38 fail_if((*number_of_listed_files) != test_count);
39 fail_if(*files_count != test_count);
69 *number_of_listed_files = DONE_CALLED; 40 *number_of_listed_files = DONE_CALLED;
70 ecore_main_loop_quit(); 41 ecore_main_loop_quit();
71} 42}
72 43
73static void 44static void
74_error_cb(void *data EINA_UNUSED, Eina_Error error) 45_error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
75{ 46{
76 const char *msg = eina_error_msg_get(error); 47 Efl_Future_Event_Failure *failure = ev->info;
48 const char *msg = eina_error_msg_get(failure->error);
49
77 EINA_LOG_ERR("error: %s", msg); 50 EINA_LOG_ERR("error: %s", msg);
78 ecore_main_loop_quit(); 51 ecore_main_loop_quit();
79} 52}
80 53
81static void 54static void
82_open_done_cb(void *data, void *file_value) 55_open_done_cb(void *data, const Efl_Event *ev)
83{ 56{
57 Efl_Future_Event_Success *success = ev->info;
84 Eina_Bool *opened = (Eina_Bool *)data; 58 Eina_Bool *opened = (Eina_Bool *)data;
85 *opened = EINA_TRUE; 59 Eina_File* file = eina_file_dup(success->value);
86 Eina_File* file = eina_file_dup(file_value);
87 eina_file_close(file); 60 eina_file_close(file);
61
62 *opened = EINA_TRUE;
88 ecore_main_loop_quit(); 63 ecore_main_loop_quit();
89} 64}
90 65
91static void 66static void
92_stat_done_cb(void *data, void *value) 67_stat_done_cb(void *data, const Efl_Event *ev)
93{ 68{
94 Eina_Stat const* stat = value; 69 Efl_Future_Event_Success *success = ev->info;
70 Eina_Stat const* stat = success->value;
95 Eina_Bool *is_dir = data; 71 Eina_Bool *is_dir = data;
96 unsigned int rights; 72 unsigned int rights;
73
97 fail_if(eio_file_is_dir(stat) != *is_dir); 74 fail_if(eio_file_is_dir(stat) != *is_dir);
98 fail_if(eio_file_is_lnk(stat)); 75 fail_if(eio_file_is_lnk(stat));
99 rights = stat->mode & (S_IRWXU | S_IRWXG | S_IRWXO); 76 rights = stat->mode & (S_IRWXU | S_IRWXG | S_IRWXO);
@@ -101,50 +78,46 @@ _stat_done_cb(void *data, void *value)
101 ecore_main_loop_quit(); 78 ecore_main_loop_quit();
102} 79}
103 80
104typedef Eina_Promise* (*Efl_Io_Manager_Test_Stat_Ls_Func)(Eo *job, const char *path);
105
106static void 81static void
107_do_ls_test(Efl_Io_Manager_Test_Stat_Ls_Func ls_func, 82_test_ls(Efl_Future *(*func)(Eo *obj, const char *path, Eina_Bool recursive),
108 const Efl_Event_Description *event, 83 uint64_t expected_test_count,
109 Efl_Event_Cb filter_cb, 84 const char* test_dirname)
110 Eina_Promise_Progress_Cb progress_cb,
111 int expected_test_count,
112 const char* test_dirname)
113{ 85{
114 int main_files = 0; 86 Efl_Io_Manager *job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
87 Efl_Future *f = NULL;
88 uint64_t main_files = 0;
115 89
116 Efl_Io_Manager *job = efl_add(EFL_IO_MANAGER_CLASS, NULL); 90 fail_if(!job);
117 Eina_Promise *promise = NULL;
118 91
119 efl_event_callback_add(job, event, filter_cb, NULL); 92 f = func(job, test_dirname, EINA_FALSE);
120 promise = ls_func(job, test_dirname); 93 fail_if(!f);
121 test_count = expected_test_count; 94 test_count = expected_test_count;
122 eina_promise_progress_cb_add(promise, progress_cb, &main_files, NULL); 95 efl_future_then(f, &_done_cb, &_error_cb, &_progress_cb, &main_files);
123 eina_promise_then(promise, &_done_cb, &_error_cb, &main_files);
124 96
125 ecore_main_loop_begin(); 97 ecore_main_loop_begin();
126 98
127 fail_if(main_files != DONE_CALLED); 99 fail_if(main_files != DONE_CALLED);
100 main_files = 0;
128 101
129 efl_unref(job); 102 f = func(job, test_dirname, EINA_TRUE);
130} 103 test_count = expected_test_count + 4;
104 efl_future_then(f, &_done_cb, &_error_cb, &_progress_cb, &main_files);
131 105
132static void 106 ecore_main_loop_begin();
133_do_direct_ls_test(Efl_Io_Manager_Test_Stat_Ls_Func ls_func, 107
134 int expected_test_count, 108 fail_if(main_files != DONE_CALLED);
135 const char *test_dirname) 109
136{ 110 efl_del(job);
137 _do_ls_test(ls_func,
138 EFL_IO_MANAGER_EVENT_FILTER_DIRECT,
139 (Efl_Event_Cb)&_filter_direct_cb,
140 (Eina_Promise_Progress_Cb)&_main_direct_cb,
141 expected_test_count,
142 test_dirname);
143} 111}
144 112
145START_TEST(efl_io_manager_test_file_direct_stat) 113START_TEST(efl_io_manager_test_stat)
146{ 114{
147 Eina_Bool is_dir; 115 Eina_Tmpstr *test_dirname;
116 Eina_Tmpstr *nested_dirname;
117 Eina_Tmpstr *nested_filename;
118 Efl_Io_Manager *job;
119 Efl_Future *f;
120 Eina_Bool is_dir = EINA_TRUE;
148 int ret; 121 int ret;
149 122
150 ret = ecore_init(); 123 ret = ecore_init();
@@ -156,26 +129,25 @@ START_TEST(efl_io_manager_test_file_direct_stat)
156 ret = ecore_file_init(); 129 ret = ecore_file_init();
157 fail_if(ret < 1); 130 fail_if(ret < 1);
158 131
159 Eina_Tmpstr *test_dirname = get_eio_test_file_tmp_dir(); 132 test_dirname = get_eio_test_file_tmp_dir();
160 Eina_Tmpstr *nested_dirname = create_test_dirs(test_dirname); 133 nested_dirname = create_test_dirs(test_dirname);
161 Eina_Tmpstr *nested_filename = get_full_path(test_dirname, files[3]); 134 nested_filename = get_full_path(test_dirname, files[3]);
162 135
163 Efl_Io_Manager *job = efl_add(EFL_IO_MANAGER_CLASS, NULL); 136 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
164 Eina_Promise *promise = NULL; 137 fail_if(!job);
165 // Start testing
166 is_dir = EINA_TRUE;
167 138
168 promise = efl_io_manager_file_direct_stat(job, nested_dirname); 139 // Start testing
169 eina_promise_then(promise, &_stat_done_cb, &_error_cb, &is_dir); 140 f = efl_io_manager_stat(job, nested_dirname);
141 efl_future_then(f, &_stat_done_cb, &_error_cb, NULL, &is_dir);
170 ecore_main_loop_begin(); 142 ecore_main_loop_begin();
171 143
172 is_dir = EINA_FALSE; 144 is_dir = EINA_FALSE;
173 promise = efl_io_manager_file_direct_stat(job, nested_filename); 145 f = efl_io_manager_stat(job, nested_filename);
174 eina_promise_then(promise, &_stat_done_cb, &_error_cb, &is_dir); 146 efl_future_then(f, &_stat_done_cb, &_error_cb, NULL, &is_dir);
175 ecore_main_loop_begin(); 147 ecore_main_loop_begin();
176 efl_unref(job);
177 148
178 // Cleanup 149 // Cleanup
150 efl_del(job);
179 fail_if(!ecore_file_recursive_rm(test_dirname)); 151 fail_if(!ecore_file_recursive_rm(test_dirname));
180 152
181 eina_tmpstr_del(nested_dirname); 153 eina_tmpstr_del(nested_dirname);
@@ -188,8 +160,14 @@ START_TEST(efl_io_manager_test_file_direct_stat)
188} 160}
189END_TEST 161END_TEST
190 162
191START_TEST(efl_io_manager_test_ls_funcs) 163START_TEST(efl_io_manager_test_ls)
192{ 164{
165 Eina_Tmpstr *test_dirname;
166 Eina_Tmpstr *nested_dirname;
167 Eina_Tmpstr *nested_filename;
168 Efl_Io_Manager *job;
169 Efl_Future *f;
170 uint64_t main_files = 0;
193 int ret; 171 int ret;
194 172
195 ret = ecore_init(); 173 ret = ecore_init();
@@ -201,28 +179,30 @@ START_TEST(efl_io_manager_test_ls_funcs)
201 ret = ecore_file_init(); 179 ret = ecore_file_init();
202 fail_if(ret < 1); 180 fail_if(ret < 1);
203 181
204 Eina_Tmpstr *test_dirname = get_eio_test_file_tmp_dir(); 182 test_dirname = get_eio_test_file_tmp_dir();
205 Eina_Tmpstr *nested_dirname = create_test_dirs(test_dirname); 183 nested_dirname = create_test_dirs(test_dirname);
206 Eina_Tmpstr *nested_filename = get_full_path(test_dirname, files[3]); 184 nested_filename = get_full_path(test_dirname, files[3]);
207 185
208 // Start testing 186 // Start testing
187 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
188 fail_if(!job);
209 189
210 _do_ls_test(&efl_io_manager_file_ls, 190 f = efl_io_manager_ls(job, test_dirname);
211 EFL_IO_MANAGER_EVENT_FILTER_NAME, 191 test_count = 6;
212 (Efl_Event_Cb)&_filter_cb, 192 efl_future_then(f, &_done_cb, &_error_cb, &_progress_cb, &main_files);
213 (Eina_Promise_Progress_Cb)&_main_cb,
214 5,
215 test_dirname);
216
217 _do_direct_ls_test(&efl_io_manager_file_stat_ls, 5, test_dirname);
218 193
219 _do_direct_ls_test(&efl_io_manager_file_direct_ls, 5, test_dirname); 194 ecore_main_loop_begin();
220 195
221 _do_direct_ls_test(&efl_io_manager_dir_stat_ls, 8, test_dirname); 196 fail_if(main_files != DONE_CALLED);
222 197
223 _do_direct_ls_test(&efl_io_manager_dir_direct_ls, 8, test_dirname); 198 // No recursion for efl_io_manager_ls, should I fix that ?
199 /* _test_ls(&efl_io_manager_ls, 5, test_dirname); */
200 direct = EINA_TRUE;
201 _test_ls(&efl_io_manager_stat_ls, 6, test_dirname);
202 _test_ls(&efl_io_manager_direct_ls, 6, test_dirname);
224 203
225 // Cleanup 204 // Cleanup
205 efl_del(job);
226 fail_if(!ecore_file_recursive_rm(test_dirname)); 206 fail_if(!ecore_file_recursive_rm(test_dirname));
227 207
228 eina_tmpstr_del(nested_dirname); 208 eina_tmpstr_del(nested_dirname);
@@ -237,7 +217,12 @@ END_TEST
237 217
238START_TEST(efl_io_manager_test_open) 218START_TEST(efl_io_manager_test_open)
239{ 219{
240 Eina_Bool opened_file; 220 Eina_Tmpstr *test_dirname;
221 Eina_Tmpstr *nested_dirname;
222 Eina_Tmpstr *nested_filename;
223 Efl_Io_Manager *job;
224 Efl_Future *f;
225 Eina_Bool opened_file = EINA_FALSE;
241 int ret; 226 int ret;
242 227
243 ret = ecore_init(); 228 ret = ecore_init();
@@ -249,21 +234,20 @@ START_TEST(efl_io_manager_test_open)
249 ret = eio_init(); 234 ret = eio_init();
250 fail_if(ret < 1); 235 fail_if(ret < 1);
251 236
252 Eina_Tmpstr *test_dirname = get_eio_test_file_tmp_dir(); 237 test_dirname = get_eio_test_file_tmp_dir();
253 Eina_Tmpstr *nested_dirname = create_test_dirs(test_dirname); 238 nested_dirname = create_test_dirs(test_dirname);
254 Eina_Tmpstr *nested_filename = get_full_path(test_dirname, files[3]); 239 nested_filename = get_full_path(test_dirname, files[3]);
255 240
256 opened_file = EINA_FALSE; 241 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
257 Efl_Io_Manager *job = efl_add(EFL_IO_MANAGER_CLASS, NULL);
258 Eina_Promise *promise = NULL;
259 242
260 promise = efl_io_manager_file_open(job, nested_filename, EINA_FALSE); 243 f = efl_io_manager_open(job, nested_filename, EINA_FALSE);
261 eina_promise_then(promise, &_open_done_cb, &_error_cb, &opened_file); 244 efl_future_then(f, &_open_done_cb, &_error_cb, NULL, &opened_file);
262 ecore_main_loop_begin(); 245 ecore_main_loop_begin();
263 efl_unref(job); 246
264 fail_if(!opened_file); 247 fail_if(!opened_file);
265 248
266 // Cleanup 249 // Cleanup
250 efl_del(job);
267 fail_if(!ecore_file_recursive_rm(test_dirname)); 251 fail_if(!ecore_file_recursive_rm(test_dirname));
268 252
269 eina_tmpstr_del(nested_dirname); 253 eina_tmpstr_del(nested_dirname);
@@ -300,8 +284,8 @@ END_TEST
300void 284void
301eio_test_job(TCase *tc) 285eio_test_job(TCase *tc)
302{ 286{
303 tcase_add_test(tc, efl_io_manager_test_ls_funcs); 287 tcase_add_test(tc, efl_io_manager_test_ls);
304 tcase_add_test(tc, efl_io_manager_test_file_direct_stat); 288 tcase_add_test(tc, efl_io_manager_test_stat);
305 tcase_add_test(tc, efl_io_manager_test_open); 289 tcase_add_test(tc, efl_io_manager_test_open);
306 tcase_add_test(tc, efl_io_instantiated); 290 tcase_add_test(tc, efl_io_instantiated);
307} 291}
diff --git a/src/tests/eio/eio_test_manager_xattr.c b/src/tests/eio/eio_test_manager_xattr.c
index acee0b4707..180a080c94 100644
--- a/src/tests/eio/eio_test_manager_xattr.c
+++ b/src/tests/eio/eio_test_manager_xattr.c
@@ -36,17 +36,10 @@ static const char *attr_data[] =
36int total_attributes = sizeof(attribute)/sizeof(attribute[0]); 36int total_attributes = sizeof(attribute)/sizeof(attribute[0]);
37 37
38static void 38static void
39_filter_cb(void *data EINA_UNUSED, const Efl_Event *event) 39_main_cb(void *data, const Efl_Event *ev)
40{ 40{
41 Eio_Filter_Name_Data *event_info = event->info; 41 Efl_Future_Event_Success *success = ev->info;
42 42 const char* attr = success->value;
43 event_info->filter = EINA_TRUE;
44}
45
46static void
47_main_cb(void *data, void *v)
48{
49 const char* attr = v;
50 int *num_of_attr = (int *)data; 43 int *num_of_attr = (int *)data;
51 unsigned int i; 44 unsigned int i;
52 45
@@ -56,11 +49,10 @@ _main_cb(void *data, void *v)
56 (*num_of_attr)++; 49 (*num_of_attr)++;
57 break; 50 break;
58 } 51 }
59
60} 52}
61 53
62static void 54static void
63_done_cb(void *data, void *value EINA_UNUSED) 55_done_cb(void *data, const Efl_Event *ev EINA_UNUSED)
64 56
65{ 57{
66 int *num_of_attr = (int *)data; 58 int *num_of_attr = (int *)data;
@@ -71,16 +63,19 @@ _done_cb(void *data, void *value EINA_UNUSED)
71} 63}
72 64
73static void 65static void
74_done_get_cb(void *data EINA_UNUSED, void* v) 66_done_get_cb(void *data EINA_UNUSED, const Efl_Event *ev)
75{ 67{
76 Eina_Iterator** it = (Eina_Iterator**)v; 68 Efl_Future_Event_Success *success = ev->info;
69 Eina_Accessor *ac = success->value;
77 int i = 0; 70 int i = 0;
78 Eio_Xattr_Data *get_data; 71 Eina_Binbuf *buf;
79 72
80 while (eina_iterator_next((*it), (void**)&get_data)) 73 EINA_ACCESSOR_FOREACH(ac, i, buf)
81 { 74 {
82 fail_if(!get_data); 75 fail_if(!buf);
83 fail_if(strcmp(get_data->data, attr_data[i]) != 0); 76 fail_if(strcmp((const char*) eina_binbuf_string_get(buf),
77 attr_data[i]) != 0);
78
84 i++; 79 i++;
85 } 80 }
86 81
@@ -90,12 +85,15 @@ _done_get_cb(void *data EINA_UNUSED, void* v)
90} 85}
91 86
92static void 87static void
93_done_set_cb(void *data, void* v) 88_done_set_cb(void *data, const Efl_Event *ev)
94{ 89{
95 Eina_Iterator** it = (Eina_Iterator**)v; 90 Efl_Future_Event_Success *success = ev->info;
91 Eina_Accessor *ac = success->value;
96 int *placeholder; 92 int *placeholder;
97 int *num_of_attr = data; 93 int *num_of_attr = data;
98 while(eina_iterator_next((*it), (void**)&placeholder)) 94 int i = 0;
95
96 EINA_ACCESSOR_FOREACH(ac, i, placeholder)
99 *num_of_attr += 1; 97 *num_of_attr += 1;
100 98
101 fail_if(*num_of_attr != total_attributes); 99 fail_if(*num_of_attr != total_attributes);
@@ -104,10 +102,11 @@ _done_set_cb(void *data, void* v)
104} 102}
105 103
106static void 104static void
107_error_cb(void *data EINA_UNUSED, Eina_Error error) 105_error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
108
109{ 106{
110 fprintf(stderr, "Something has gone wrong:%s\n", eina_error_msg_get(error)); 107 Efl_Future_Event_Failure *failure = ev->info;
108
109 fprintf(stderr, "Something has gone wrong:%s\n", eina_error_msg_get(failure->error));
111 abort(); 110 abort();
112 111
113 ecore_main_loop_quit(); 112 ecore_main_loop_quit();
@@ -120,16 +119,14 @@ START_TEST(eio_test_job_xattr_set)
120 int num_of_attr = 0, fd; 119 int num_of_attr = 0, fd;
121 unsigned int i; 120 unsigned int i;
122 Eo *job; 121 Eo *job;
123 Eina_Promise *list_promise = NULL; 122 Efl_Future *ls = NULL;
124 Eina_Promise **attrib_promises = NULL; 123 Efl_Future **futures = NULL;
125 124
126 ecore_init(); 125 ecore_init();
127 eina_init(); 126 eina_init();
128 eio_init(); 127 eio_init();
129 128
130 fprintf(stderr, "eio_test_job_xattr_set\n"); fflush(stderr); 129 job = efl_add(EFL_IO_MANAGER_CLASS, ecore_main_loop_get());
131
132 job = efl_add(EFL_IO_MANAGER_CLASS, NULL);
133 130
134 test_file_path = get_full_path(XATTR_TEST_DIR, filename); 131 test_file_path = get_full_path(XATTR_TEST_DIR, filename);
135 fd = open(test_file_path, 132 fd = open(test_file_path,
@@ -137,52 +134,51 @@ START_TEST(eio_test_job_xattr_set)
137 S_IRWXU | S_IRWXG | S_IRWXO); 134 S_IRWXU | S_IRWXG | S_IRWXO);
138 fail_if(fd == 0); 135 fail_if(fd == 0);
139 136
140 attrib_promises = (Eina_Promise**)calloc(total_attributes + 1, sizeof(Eina_Promise*)); 137 futures = calloc(total_attributes + 1, sizeof(Efl_Future*));
141 attrib_promises[total_attributes] = NULL; 138 futures[total_attributes] = NULL;
142 139
143 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i) 140 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
144 { 141 {
145 attrib_promises[i] = efl_io_manager_file_xattr_set 142 Eina_Binbuf *buf;
146 (job, test_file_path, attribute[i], 143
147 attr_data[i], strlen(attr_data[i]), 144 buf = eina_binbuf_manage_new((const unsigned char*) attr_data[i], strlen(attr_data[i]), EINA_TRUE);
148 EINA_XATTR_INSERT); 145 futures[i] = efl_io_manager_xattr_set(job, test_file_path, attribute[i], buf, EINA_XATTR_INSERT);
146 eina_binbuf_free(buf);
149 147
150 fail_if(num_of_attr != 0); // test asynchronous 148 fail_if(num_of_attr != 0); // test asynchronous
151 } 149 }
152 eina_promise_then(eina_promise_all(eina_carray_iterator_new((void**)attrib_promises)), 150 efl_future_then(efl_future_iterator_all(eina_carray_iterator_new((void**) futures)),
153 &_done_set_cb, _error_cb, &num_of_attr); 151 _done_set_cb, _error_cb, NULL, &num_of_attr);
154 152
155 ecore_main_loop_begin(); 153 ecore_main_loop_begin();
156 154
157 free(attrib_promises); 155 free(futures);
158 156
159 num_of_attr = 0; 157 num_of_attr = 0;
160 158
161 attrib_promises = (Eina_Promise**)calloc(total_attributes + 1, sizeof(Eina_Promise*)); 159 futures = calloc(total_attributes + 1, sizeof(Eina_Promise*));
162 attrib_promises[total_attributes] = NULL; 160 futures[total_attributes] = NULL;
163 161
164 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i) 162 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
165 { 163 {
166 attrib_promises[i] = efl_io_manager_file_xattr_get(job, test_file_path, attribute[i]); 164 futures[i] = efl_io_manager_xattr_get(job, test_file_path, attribute[i]);
167 } 165 }
168 166
169 eina_promise_then(eina_promise_all(eina_carray_iterator_new((void**)attrib_promises)), 167 efl_future_then(efl_future_iterator_all(eina_carray_iterator_new((void**)futures)),
170 _done_get_cb, _error_cb, &num_of_attr); 168 _done_get_cb, _error_cb, NULL, &num_of_attr);
171 169
172 ecore_main_loop_begin(); 170 ecore_main_loop_begin();
173 171
174 num_of_attr = 0; 172 num_of_attr = 0;
175 173
176 efl_event_callback_add(job, EFL_IO_MANAGER_EVENT_XATTR, _filter_cb, NULL); 174 efl_future_use(&ls, efl_io_manager_xattr_ls(job, test_file_path));
177 list_promise = efl_io_manager_file_xattr_list_get(job, test_file_path); 175 efl_future_then(ls, _done_cb, _error_cb, _main_cb, &num_of_attr);
178 eina_promise_progress_cb_add(list_promise, _main_cb, &num_of_attr, NULL);
179 eina_promise_then(list_promise, _done_cb, _error_cb, &num_of_attr);
180 176
181 fail_if(num_of_attr != 0); 177 fail_if(num_of_attr != 0);
182 178
183 ecore_main_loop_begin(); 179 ecore_main_loop_begin();
184 180
185 free(attrib_promises); 181 free(futures);
186 182
187 efl_unref(job); 183 efl_unref(job);
188 close(fd); 184 close(fd);