summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-14 11:01:01 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-14 11:01:22 -0700
commitfb31440f494d1810264a3c6ad408bd286dca8b76 (patch)
treeebce9e30e8207e60e1d14aebde9e9d6cce876ded /src
parent112777fc7a7c7f0bbdbe21ce70d2074367710a88 (diff)
eina: move the test to the new future and use the new Eina_Value array iterator macro.
Diffstat (limited to 'src')
-rw-r--r--src/tests/eio/eio_test_manager_xattr.c55
1 files changed, 31 insertions, 24 deletions
diff --git a/src/tests/eio/eio_test_manager_xattr.c b/src/tests/eio/eio_test_manager_xattr.c
index 15615ebb81..261d2e2c8b 100644
--- a/src/tests/eio/eio_test_manager_xattr.c
+++ b/src/tests/eio/eio_test_manager_xattr.c
@@ -70,34 +70,44 @@ _done_cb(void *data, const Efl_Event *ev EINA_UNUSED)
70} 70}
71 71
72static void 72static void
73_done_get_cb(void *data EINA_UNUSED, const Efl_Event *ev) 73_error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
74{ 74{
75 Efl_Future_Event_Success *success = ev->info; 75 Efl_Future_Event_Failure *failure = ev->info;
76 Eina_Accessor *ac = success->value; 76
77 int i = 0; 77 fprintf(stderr, "Something has gone wrong:%s\n", eina_error_msg_get(failure->error));
78 abort();
79
80 ecore_main_loop_quit();
81}
82
83static Eina_Value
84_future_done_cb(void *data EINA_UNUSED,
85 const Eina_Value array,
86 const Eina_Future *dead EINA_UNUSED)
87{
88 Eina_Error err;
89 unsigned int i, len;
90 Eina_Value v = EINA_VALUE_EMPTY;
78 Eina_Binbuf *buf; 91 Eina_Binbuf *buf;
79 92
80 EINA_ACCESSOR_FOREACH(ac, i, buf) 93 if (array.type == EINA_VALUE_TYPE_ERROR)
81 { 94 {
95 eina_value_get(&array, &err);
96 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
97 abort();
98 }
99 EINA_VALUE_ARRAY_FOREACH(&array, len, i, &v)
100 {
101 buf = eina_value_to_binbuf(&v);
82 fail_if(!buf); 102 fail_if(!buf);
83 fail_if(strcmp((const char*) eina_binbuf_string_get(buf), 103 fail_if(strcmp((const char*) eina_binbuf_string_get(buf),
84 attr_data[i]) != 0); 104 attr_data[i]) != 0);
85 } 105 }
86 106
87 fail_if(i != total_attributes); 107 fail_if((int) i != total_attributes);
88
89 ecore_main_loop_quit();
90}
91
92static void
93_error_cb(void *data EINA_UNUSED, const Efl_Event *ev)
94{
95 Efl_Future_Event_Failure *failure = ev->info;
96
97 fprintf(stderr, "Something has gone wrong:%s\n", eina_error_msg_get(failure->error));
98 abort();
99 108
100 ecore_main_loop_quit(); 109 ecore_main_loop_quit();
110 return array;
101} 111}
102 112
103static Eina_Value 113static Eina_Value
@@ -107,6 +117,7 @@ _future_all_cb(void *data,
107{ 117{
108 Eina_Error err; 118 Eina_Error err;
109 unsigned int i, len; 119 unsigned int i, len;
120 Eina_Value v = EINA_VALUE_EMPTY;
110 int *num_of_attr = (int *)data; 121 int *num_of_attr = (int *)data;
111 122
112 if (array.type == EINA_VALUE_TYPE_ERROR) 123 if (array.type == EINA_VALUE_TYPE_ERROR)
@@ -115,12 +126,8 @@ _future_all_cb(void *data,
115 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err)); 126 fprintf(stderr, "Something has gone wrong: %s\n", eina_error_msg_get(err));
116 abort(); 127 abort();
117 } 128 }
118 len = eina_value_array_count(&array); 129 EINA_VALUE_ARRAY_FOREACH(&array, len, i, &v)
119 for (i = 0; i < len; i++)
120 { 130 {
121 Eina_Value v;
122
123 eina_value_array_get(&array, i, &v);
124 if (v.type == EINA_VALUE_TYPE_ERROR) 131 if (v.type == EINA_VALUE_TYPE_ERROR)
125 { 132 {
126 eina_value_get(&v, &err); 133 eina_value_get(&v, &err);
@@ -185,8 +192,8 @@ START_TEST(eio_test_job_xattr_set)
185 futures[i] = efl_io_manager_xattr_get(job, test_file_path, attribute[i]); 192 futures[i] = efl_io_manager_xattr_get(job, test_file_path, attribute[i]);
186 } 193 }
187 194
188 efl_future_then(efl_future_iterator_all(eina_carray_iterator_new((void**)futures)), 195 eina_future_then(eina_future_all_array(futures),
189 _done_get_cb, _error_cb, NULL, &num_of_attr); 196 _future_done_cb, &num_of_attr);
190 197
191 ecore_main_loop_begin(); 198 ecore_main_loop_begin();
192 199