summaryrefslogtreecommitdiff
path: root/src/tests/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-11 16:10:46 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-11 16:10:46 -0700
commite33d0d99963f16038d33f8d95cf5427e2ed29390 (patch)
tree2374193c7e4538451a61777ea3712c152dff0936 /src/tests/eio
parentfa9acf8b356b4e6d5ae899770b64f98e1f1a67f0 (diff)
eio: first convertion to new future/promise.
Diffstat (limited to 'src/tests/eio')
-rw-r--r--src/tests/eio/eio_test_manager_xattr.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/src/tests/eio/eio_test_manager_xattr.c b/src/tests/eio/eio_test_manager_xattr.c
index b858de6534..3d41316f20 100644
--- a/src/tests/eio/eio_test_manager_xattr.c
+++ b/src/tests/eio/eio_test_manager_xattr.c
@@ -117,6 +117,39 @@ _error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
117 ecore_main_loop_quit(); 117 ecore_main_loop_quit();
118} 118}
119 119
120static Eina_Value
121_future_all_cb(const void *data,
122 const Eina_Value array,
123 const Eina_Future *dead EINA_UNUSED)
124{
125 Eina_Error err;
126 unsigned int i, len;
127 int *num_of_attr = (int *)data;
128
129 if (array.type == EINA_VALUE_TYPE_ERROR)
130 {
131 eina_value_get(&array, &err);
132 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
133 abort();
134 }
135 len = eina_value_array_count(&array);
136 for (i = 0; i < len; i++)
137 {
138 Eina_Value v;
139
140 eina_value_array_get(&array, i, &v);
141 if (v.type == EINA_VALUE_TYPE_ERROR)
142 {
143 eina_value_get(&v, &err);
144 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
145 abort();
146 }
147 }
148
149 fail_if(*num_of_attr != len);
150 return array;
151}
152
120START_TEST(eio_test_job_xattr_set) 153START_TEST(eio_test_job_xattr_set)
121{ 154{
122 char *filename = "eio-tmpfile"; 155 char *filename = "eio-tmpfile";
@@ -125,7 +158,7 @@ START_TEST(eio_test_job_xattr_set)
125 unsigned int i; 158 unsigned int i;
126 Eo *job; 159 Eo *job;
127 Efl_Future *ls = NULL; 160 Efl_Future *ls = NULL;
128 Efl_Future **futures = NULL; 161 Eina_Future **futures = NULL;
129 162
130 ecore_init(); 163 ecore_init();
131 eina_init(); 164 eina_init();
@@ -139,8 +172,8 @@ START_TEST(eio_test_job_xattr_set)
139 S_IRWXU | S_IRWXG | S_IRWXO); 172 S_IRWXU | S_IRWXG | S_IRWXO);
140 fail_if(fd == 0); 173 fail_if(fd == 0);
141 174
142 futures = calloc(total_attributes + 1, sizeof(Efl_Future*)); 175 futures = calloc(total_attributes + 1, sizeof(Eina_Future*));
143 futures[total_attributes] = NULL; 176 futures[total_attributes] = EINA_FUTURE_SENTINEL;
144 177
145 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i) 178 for (i = 0; i < sizeof(attribute) / sizeof(attribute[0]); ++i)
146 { 179 {
@@ -152,8 +185,8 @@ START_TEST(eio_test_job_xattr_set)
152 185
153 fail_if(num_of_attr != 0); // test asynchronous 186 fail_if(num_of_attr != 0); // test asynchronous
154 } 187 }
155 efl_future_then(efl_future_iterator_all(eina_carray_iterator_new((void**) futures)), 188 eina_future_then(eina_future_all_array(futures),
156 _done_set_cb, _error_cb, NULL, &num_of_attr); 189 _future_all_cb, &num_of_attr);
157 190
158 ecore_main_loop_begin(); 191 ecore_main_loop_begin();
159 192