e_connman0_7x: phase-1 - revert to old code
[framework/uifw/edbus.git] / src / bin / e_dbus_connman0_7x_test_api.c
1 #ifdef HAVE_CONFIG_H
2 #include "config.h"
3 #endif
4
5 #define E_CONNMAN_I_KNOW_THIS_API_IS_SUBJECT_TO_CHANGE 1
6 #include "E_Connman.h"
7 #include <stdio.h>
8 #include <string.h>
9
10 #define DBG(...) EINA_LOG_DBG(__VA_ARGS__)
11 #define INF(...) EINA_LOG_INFO(__VA_ARGS__)
12 #define WRN(...) EINA_LOG_WARN(__VA_ARGS__)
13 #define ERR(...) EINA_LOG_ERR(__VA_ARGS__)
14
15 static int success = 0;
16 static int failure = 0;
17 static Ecore_Timer *exiter = NULL;
18
19 static Eina_Bool
20 _test_string_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, const char **value))
21 {
22    const char *value;
23    Eina_Bool ret;
24
25    INF("BEGIN: testing string get %s of element %s...", name, element->path);
26    ret = func(element, &value);
27    if (ret)
28      INF("SUCCESS: testing string get %s of element %s: %s",
29          name, element->path, value);
30    else
31      WRN("FAILURE: testing string get %s of element %s",
32          name, element->path);
33
34    return ret;
35 }
36
37 static Eina_Bool
38 _test_string_array_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, unsigned int *count, const char ***value))
39 {
40    const char **value;
41    unsigned int count;
42    Eina_Bool ret;
43
44    INF("BEGIN: testing string array get %s of element %s...",
45        name, element->path);
46    ret = func(element, &count, &value);
47    if (ret)
48      {
49         INF("SUCCESS: testing string array get %s of element %s: %p[%u]",
50             name, element->path, value, count);
51      }
52    else
53      WRN("FAILURE: testing string get %s of element %s",
54          name, element->path);
55
56    return ret;
57 }
58
59 static Eina_Bool
60 _test_bool_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, Eina_Bool *value))
61 {
62    Eina_Bool value, ret;
63
64    INF("BEGIN: testing Eina_Bool get %s of element %s...", name, element->path);
65    ret = func(element, &value);
66    if (ret)
67      INF("SUCCESS: testing Eina_Bool get %s of element %s: %hhu",
68          name, element->path, value);
69    else
70      WRN("FAILURE: testing Eina_Bool get %s of element %s",
71          name, element->path);
72
73    return ret;
74 }
75
76 static Eina_Bool
77 _test_uchar_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, unsigned char *value))
78 {
79    unsigned char value;
80    Eina_Bool ret;
81
82    INF("BEGIN: testing uchar get %s of element %s...", name, element->path);
83    ret = func(element, &value);
84    if (ret)
85      INF("SUCCESS: testing uchar get %s of element %s: %hhu",
86          name, element->path, value);
87    else
88      WRN("FAILURE: testing uchar get %s of element %s",
89          name, element->path);
90
91    return ret;
92 }
93
94 static Eina_Bool
95 _test_ushort_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, unsigned short *value))
96 {
97    unsigned short value;
98    Eina_Bool ret;
99
100    INF("BEGIN: testing ushort get %s of element %s...", name, element->path);
101    ret = func(element, &value);
102    if (ret)
103      INF("SUCCESS: testing ushort get %s of element %s: %hu",
104          name, element->path, value);
105    else
106      WRN("FAILURE: testing ushort get %s of element %s",
107          name, element->path);
108
109    return ret;
110 }
111
112 static Eina_Bool
113 _test_uchar_array_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, unsigned int *count, unsigned char **value))
114 {
115    unsigned char *value;
116    unsigned int count;
117    Eina_Bool ret;
118
119    INF("BEGIN: testing uchar array get %s of element %s...",
120        name, element->path);
121    ret = func(element, &count, &value);
122    if (ret)
123      {
124         INF("SUCCESS: testing uchar array get %s of element %s: %p[%u]",
125             name, element->path, value, count);
126         free(value);
127      }
128    else
129      WRN("FAILURE: testing uchar array get %s of element %s",
130          name, element->path);
131
132    return ret;
133 }
134
135 static Eina_Bool
136 _test_element_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, E_Connman_Element **value))
137 {
138    E_Connman_Element *value;
139    Eina_Bool ret;
140
141    INF("BEGIN: testing element get %s of element %s...", name, element->path);
142    ret = func(element, &value);
143    if (ret)
144      INF("SUCCESS: testing element get %s of element %s: %p",
145          name, element->path, value);
146    else
147      WRN("FAILURE: testing element get %s of element %s",
148          name, element->path);
149
150    return ret;
151 }
152
153 static Eina_Bool
154 _test_elements_get(E_Connman_Element *element, const char *name, Eina_Bool (*func)(const E_Connman_Element *element, unsigned int *count, E_Connman_Element ***elements))
155 {
156    E_Connman_Element **value;
157    unsigned int count;
158    Eina_Bool ret;
159
160    INF("BEGIN: testing elements get %s of element %s...",
161        name, element->path);
162    ret = func(element, &count, &value);
163    if (ret)
164      {
165         INF("SUCCESS: testing elements get %s of element %s: %p",
166             name, element->path, value);
167         free(value);
168      }
169    else
170      WRN("FAILURE: testing elements get %s of element %s",
171          name, element->path);
172
173    return ret;
174 }
175
176 static Eina_Bool
177 _test_element_get_global(const char *name, Eina_Bool (*func)(E_Connman_Element **value))
178 {
179    E_Connman_Element *value;
180    Eina_Bool ret;
181
182    INF("BEGIN: testing element get %s", name);
183    ret = func(&value);
184    if (ret)
185      INF("SUCCESS: testing element get %s: %p", name, value);
186    else
187      WRN("FAILURE: testing element get %s", name);
188
189    return ret;
190 }
191
192 static Eina_Bool
193 _test_elements_get_global(const char *name, Eina_Bool (*func)(unsigned int *count, E_Connman_Element ***elements))
194 {
195    E_Connman_Element **value;
196    unsigned int count;
197    Eina_Bool ret;
198
199    INF("BEGIN: testing elements get %s", name);
200    ret = func(&count, &value);
201    if (ret)
202      {
203         INF("SUCCESS: testing elements get %s: %p", name, value);
204         free(value);
205      }
206    else
207      WRN("FAILURE: testing elements get %s", name);
208
209    return ret;
210 }
211
212 static Eina_Bool
213 _test_string_get_global(const char *name, Eina_Bool (*func)(const char **value))
214 {
215    const char *value;
216    Eina_Bool ret;
217
218    INF("BEGIN: testing string get %s...", name);
219    ret = func(&value);
220    if (ret)
221      INF("SUCCESS: testing string get %s: %s", name, value);
222    else
223      WRN("FAILURE: testing string get %s", name);
224
225    return ret;
226 }
227
228 static Eina_Bool
229 _test_bool_get_global(const char *name, Eina_Bool (*func)(Eina_Bool *value))
230 {
231    Eina_Bool value, ret;
232
233    INF("BEGIN: testing Eina_Bool get %s...", name);
234    ret = func(&value);
235    if (ret)
236      INF("SUCCESS: testing Eina_Bool get %s: %hhu", name, value);
237    else
238      WRN("FAILURE: testing Eina_Bool get %s", name);
239
240    return ret;
241 }
242
243 static Eina_Bool
244 _test_strings_get_global(const char *name, Eina_Bool (*func)(unsigned int *count, const char ***elements))
245 {
246    const char **value;
247    unsigned int count;
248    Eina_Bool ret;
249
250    INF("BEGIN: testing strings get %s", name);
251    ret = func(&count, &value);
252    if (ret)
253      {
254         INF("SUCCESS: testing strings get %s: %p", name, value);
255         free(value);
256      }
257    else
258      WRN("FAILURE: testing strings get %s", name);
259
260    return ret;
261 }
262
263
264 struct test_desc
265 {
266    const char *name;
267    enum {
268      TEST_DESC_TYPE_STRING_GET,
269      TEST_DESC_TYPE_STRING_ARRAY_GET,
270      TEST_DESC_TYPE_BOOL_GET,
271      TEST_DESC_TYPE_UCHAR_GET,
272      TEST_DESC_TYPE_USHORT_GET,
273      TEST_DESC_TYPE_UCHAR_ARRAY_GET,
274      TEST_DESC_TYPE_ELEMENT_GET,
275      TEST_DESC_TYPE_ELEMENTS_GET,
276      TEST_DESC_TYPE_ELEMENT_GET_GLOBAL,
277      TEST_DESC_TYPE_ELEMENTS_GET_GLOBAL,
278      TEST_DESC_TYPE_STRING_GET_GLOBAL,
279      TEST_DESC_TYPE_BOOL_GET_GLOBAL,
280      TEST_DESC_TYPE_STRINGS_GET_GLOBAL,
281      TEST_DESC_TYPE_LAST
282    } type;
283    union {
284       Eina_Bool (*string_get)(const E_Connman_Element *element, const char **value);
285       Eina_Bool (*string_array_get)(const E_Connman_Element *element, unsigned int *count, const char ***value);
286       Eina_Bool (*bool_get)(const E_Connman_Element *element, Eina_Bool *value);
287       Eina_Bool (*uchar_get)(const E_Connman_Element *element, unsigned char *value);
288       Eina_Bool (*ushort_get)(const E_Connman_Element *element, unsigned short*value);
289       Eina_Bool (*uchar_array_get)(const E_Connman_Element *element, unsigned int *count, unsigned char **value);
290       Eina_Bool (*element_get)(const E_Connman_Element *element, E_Connman_Element **value);
291       Eina_Bool (*elements_get)(const E_Connman_Element *element, unsigned int *count, E_Connman_Element ***elements);
292       Eina_Bool (*element_get_global)(E_Connman_Element **element);
293       Eina_Bool (*elements_get_global)(unsigned int *count, E_Connman_Element ***elements);
294       Eina_Bool (*string_get_global)(const char **value);
295       Eina_Bool (*bool_get_global)(Eina_Bool *value);
296       Eina_Bool (*strings_get_global)(unsigned int *count, const char ***strings);
297       void *dummy;
298    } func;
299    Eina_Bool may_fail;
300 };
301
302 #define TEST_DESC_STRING_GET(_func, may_fail)                           \
303   {#_func, TEST_DESC_TYPE_STRING_GET, .func.string_get=_func, may_fail}
304 #define TEST_DESC_STRING_ARRAY_GET(_func, may_fail)                             \
305   {#_func, TEST_DESC_TYPE_STRING_ARRAY_GET, .func.string_array_get=_func, may_fail}
306 #define TEST_DESC_BOOL_GET(_func, may_fail)                             \
307   {#_func, TEST_DESC_TYPE_BOOL_GET, .func.bool_get=_func, may_fail}
308 #define TEST_DESC_UCHAR_GET(_func, may_fail)                            \
309   {#_func, TEST_DESC_TYPE_UCHAR_GET, .func.uchar_get=_func, may_fail}
310 #define TEST_DESC_USHORT_GET(_func, may_fail)                           \
311   {#_func, TEST_DESC_TYPE_USHORT_GET, .func.ushort_get=_func, may_fail}
312 #define TEST_DESC_UCHAR_ARRAY_GET(_func, may_fail)                      \
313   {#_func, TEST_DESC_TYPE_UCHAR_ARRAY_GET, .func.uchar_array_get=_func, may_fail}
314 #define TEST_DESC_ELEMENT_GET(_func, may_fail)                          \
315   {#_func, TEST_DESC_TYPE_ELEMENT_GET, .func.element_get=_func, may_fail}
316 #define TEST_DESC_ELEMENTS_GET(_func, may_fail)                         \
317   {#_func, TEST_DESC_TYPE_ELEMENTS_GET, .func.elements_get=_func, may_fail}
318 #define TEST_DESC_ELEMENT_GET_GLOBAL(_func, may_fail)                   \
319   {#_func, TEST_DESC_TYPE_ELEMENT_GET_GLOBAL, .func.element_get_global=_func, may_fail}
320 #define TEST_DESC_ELEMENTS_GET_GLOBAL(_func, may_fail)                  \
321   {#_func, TEST_DESC_TYPE_ELEMENTS_GET_GLOBAL, .func.elements_get_global=_func, may_fail}
322 #define TEST_DESC_STRING_GET_GLOBAL(_func, may_fail)                    \
323   {#_func, TEST_DESC_TYPE_STRING_GET_GLOBAL, .func.string_get_global=_func, may_fail}
324 #define TEST_DESC_BOOL_GET_GLOBAL(_func, may_fail)                      \
325   {#_func, TEST_DESC_TYPE_BOOL_GET_GLOBAL, .func.bool_get_global=_func, may_fail}
326 #define TEST_DESC_STRINGS_GET_GLOBAL(_func, may_fail)                   \
327   {#_func, TEST_DESC_TYPE_STRINGS_GET_GLOBAL, .func.strings_get_global=_func, may_fail}
328 #define TEST_DESC_SENTINEL {NULL, TEST_DESC_TYPE_LAST, .func.dummy=NULL}
329
330 static Eina_Bool
331 _test_element(E_Connman_Element *element, const struct test_desc *test_descs)
332 {
333    const struct test_desc *itr;
334    int total, ok = 0, fail = 0;
335    Eina_Bool ret = EINA_TRUE;
336
337    for (itr = test_descs; itr->type != TEST_DESC_TYPE_LAST; itr++)
338      {
339         Eina_Bool r;
340
341         switch (itr->type)
342           {
343            case TEST_DESC_TYPE_STRING_GET:
344               r = _test_string_get(element, itr->name, itr->func.string_get);
345               break;
346            case TEST_DESC_TYPE_STRING_ARRAY_GET:
347               r = _test_string_array_get
348                 (element, itr->name, itr->func.string_array_get);
349               break;
350            case TEST_DESC_TYPE_BOOL_GET:
351               r = _test_bool_get(element, itr->name, itr->func.bool_get);
352               break;
353            case TEST_DESC_TYPE_UCHAR_GET:
354               r = _test_uchar_get(element, itr->name, itr->func.uchar_get);
355               break;
356            case TEST_DESC_TYPE_USHORT_GET:
357               r = _test_ushort_get(element, itr->name, itr->func.ushort_get);
358               break;
359            case TEST_DESC_TYPE_UCHAR_ARRAY_GET:
360               r = _test_uchar_array_get
361                 (element, itr->name, itr->func.uchar_array_get);
362               break;
363            case TEST_DESC_TYPE_ELEMENT_GET:
364               r = _test_element_get
365                 (element, itr->name, itr->func.element_get);
366               break;
367            case TEST_DESC_TYPE_ELEMENTS_GET:
368               r = _test_elements_get
369                 (element, itr->name, itr->func.elements_get);
370               break;
371            case TEST_DESC_TYPE_ELEMENT_GET_GLOBAL:
372               r = _test_element_get_global
373                 (itr->name, itr->func.element_get_global);
374               break;
375            case TEST_DESC_TYPE_ELEMENTS_GET_GLOBAL:
376               r = _test_elements_get_global
377                 (itr->name, itr->func.elements_get_global);
378               break;
379            case TEST_DESC_TYPE_STRING_GET_GLOBAL:
380               r = _test_string_get_global
381                 (itr->name, itr->func.string_get_global);
382               break;
383            case TEST_DESC_TYPE_BOOL_GET_GLOBAL:
384               r = _test_bool_get_global
385                 (itr->name, itr->func.bool_get_global);
386               break;
387            case TEST_DESC_TYPE_STRINGS_GET_GLOBAL:
388               r = _test_strings_get_global
389                 (itr->name, itr->func.strings_get_global);
390               break;
391            default:
392               ERR("unknown test type %d (%s)", itr->type, itr->name);
393               r = 0;
394               break;
395           }
396
397         if (r || itr->may_fail)
398           ok++;
399         else
400           {
401              ERR("test failed %s, element %s [%s]",
402                  itr->name, element->path, element->interface);
403              fail++;
404              ret = EINA_FALSE;
405           }
406      }
407
408    total = ok + failure;
409    success += ok;
410    failure += fail;
411    if (total == 0)
412      {
413         INF("no tests for %s [%s]", element->path, element->interface);
414         return EINA_TRUE;
415      }
416
417    INF("testing %s success: %d, failure: %d: %d%% [%s]",
418        element->path, ok, fail, (ok * 100) / total,
419        element->interface);
420
421    return ret;
422 }
423
424 static const struct test_desc test_desc_manager[] = {
425   TEST_DESC_STRING_GET_GLOBAL(e_connman_manager_state_get, 0),
426   TEST_DESC_BOOL_GET_GLOBAL(e_connman_manager_offline_mode_get, 0),
427   //TEST_DESC_STRING_SET_GLOBAL(e_connman_manager_request_scan, 0),
428   //TEST_DESC_BOOL_SET_GLOBAL(e_connman_manager_offline_mode_set, 0),
429   TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_profiles_get, 0),
430   TEST_DESC_ELEMENTS_GET_GLOBAL(e_connman_manager_services_get, 1),
431   TEST_DESC_STRING_GET_GLOBAL(e_connman_manager_technology_default_get, 0),
432   TEST_DESC_STRINGS_GET_GLOBAL(e_connman_manager_technologies_available_get, 0),
433   TEST_DESC_STRINGS_GET_GLOBAL(e_connman_manager_technologies_enabled_get, 0),
434   TEST_DESC_STRINGS_GET_GLOBAL(e_connman_manager_technologies_connected_get, 0),
435   TEST_DESC_ELEMENT_GET_GLOBAL(e_connman_manager_profile_active_get, 0),
436   TEST_DESC_SENTINEL
437 };
438
439 static const struct test_desc test_desc_profile[] = {
440   TEST_DESC_STRING_GET(e_connman_profile_name_get, 1),
441   //TEST_DESC_STRING_SET(e_connman_profile_name_set, 1),
442   TEST_DESC_BOOL_GET(e_connman_profile_offline_mode_get, 0),
443   //TEST_DESC_BOOL_SET(e_connman_profile_offline_mode_set, 0),
444   TEST_DESC_ELEMENTS_GET(e_connman_profile_services_get, 1),
445   TEST_DESC_SENTINEL
446 };
447
448 static const struct test_desc test_desc_service[] = {
449   /* TODO: need to check exactly what properties may fail */
450   TEST_DESC_STRING_GET(e_connman_service_state_get, 1),
451   TEST_DESC_STRING_GET(e_connman_service_error_get, 1),
452   TEST_DESC_STRING_GET(e_connman_service_name_get, 0),
453   TEST_DESC_STRING_GET(e_connman_service_type_get, 0),
454   TEST_DESC_STRING_ARRAY_GET(e_connman_service_security_get, 1),
455   TEST_DESC_STRING_GET(e_connman_service_passphrase_get, 1),
456   //TEST_DESC_STRING_SET(e_connman_service_passphrase_set, 1),
457   TEST_DESC_BOOL_GET(e_connman_service_passphrase_required_get, 1),
458   TEST_DESC_UCHAR_GET(e_connman_service_strength_get, 1),
459   TEST_DESC_BOOL_GET(e_connman_service_favorite_get, 0),
460   TEST_DESC_BOOL_GET(e_connman_service_immutable_get, 0),
461   TEST_DESC_BOOL_GET(e_connman_service_auto_connect_get, 0),
462   //TEST_DESC_BOOL_SET(e_connman_service_auto_connect_set, 1),
463   TEST_DESC_BOOL_GET(e_connman_service_roaming_get, 1),
464   TEST_DESC_STRING_GET(e_connman_service_ipv4_method_get, 1),
465   TEST_DESC_STRING_GET(e_connman_service_ipv4_address_get, 1),
466   TEST_DESC_STRING_GET(e_connman_service_ipv4_gateway_get, 1),
467   TEST_DESC_STRING_GET(e_connman_service_ipv4_netmask_get, 1),
468   TEST_DESC_STRING_GET(e_connman_service_ipv4_configuration_method_get, 1),
469   TEST_DESC_STRING_GET(e_connman_service_ipv4_configuration_address_get, 1),
470   TEST_DESC_STRING_GET(e_connman_service_ipv4_configuration_gateway_get, 1),
471   TEST_DESC_STRING_GET(e_connman_service_ipv4_configuration_netmask_get, 1),
472   TEST_DESC_STRING_GET(e_connman_service_ethernet_method_get, 1),
473   TEST_DESC_STRING_GET(e_connman_service_ethernet_address_get, 1),
474   TEST_DESC_USHORT_GET(e_connman_service_ethernet_mtu_get, 1),
475   TEST_DESC_SENTINEL
476 };
477
478 static Eina_Bool
479 _quit(__UNUSED__ void *data)
480 {
481    ecore_main_loop_quit();
482    return ECORE_CALLBACK_CANCEL;
483 }
484
485 static Eina_Bool
486 _on_exiter(__UNUSED__ void *data)
487 {
488    e_connman_system_shutdown();
489    ecore_idle_enterer_add(_quit, NULL);
490    exiter = NULL;
491    return ECORE_CALLBACK_CANCEL;
492 }
493
494 static void
495 _exiter_reschedule(void)
496 {
497    if (exiter)
498      ecore_timer_del(exiter);
499    exiter = ecore_timer_add(10, _on_exiter, NULL);
500 }
501
502 struct test_element_timer_data
503 {
504    E_Connman_Element *element;
505    Ecore_Timer *timer;
506 };
507
508 static Eina_Bool
509 _test_element_timer(void *data)
510 {
511    struct test_element_timer_data *d = data;
512    E_Connman_Element *element = d->element;
513
514    if (e_connman_element_is_profile(element))
515      _test_element(element, test_desc_profile);
516    else if (e_connman_element_is_manager(element))
517      _test_element(element, test_desc_manager);
518    else if (e_connman_element_is_service(element))
519      _test_element(element, test_desc_service);
520    else
521      ERR("!!! don't know how to test %s [%s]",
522          element->path, element->interface);
523
524    _exiter_reschedule();
525
526    d->timer = NULL;
527    return ECORE_CALLBACK_CANCEL;
528 }
529
530 static void
531 _element_listener(void *data, __UNUSED__ const E_Connman_Element *element)
532 {
533    struct test_element_timer_data *d = data;
534    if (d->timer)
535      ecore_timer_del(d->timer);
536    d->timer = ecore_timer_add(1.0, _test_element_timer, d);
537    _exiter_reschedule();
538 }
539
540 static void
541 _element_listener_free(void *data)
542 {
543    struct test_element_timer_data *d = data;
544    if (d->timer)
545      ecore_timer_del(d->timer);
546    free(d);
547 }
548
549 static Eina_Bool
550 _on_element_add(__UNUSED__ void *data, __UNUSED__ int type, void *info)
551 {
552    E_Connman_Element *element = info;
553    struct test_element_timer_data *d;
554
555    d = malloc(sizeof(*d));
556    if (!d)
557      return ECORE_CALLBACK_PASS_ON;
558
559    d->element = element;
560    d->timer = ecore_timer_add(1.0, _test_element_timer, d);
561    e_connman_element_listener_add
562      (element, _element_listener, d, _element_listener_free);
563
564    return ECORE_CALLBACK_PASS_ON;
565 }
566
567 static Eina_Bool
568 _on_element_del(__UNUSED__ void *data, __UNUSED__ int type, __UNUSED__ void *info)
569 {
570    return ECORE_CALLBACK_PASS_ON;
571 }
572
573 static Eina_Bool
574 _on_element_updated(__UNUSED__ void *data, __UNUSED__ int type, __UNUSED__ void *info)
575 {
576    return ECORE_CALLBACK_PASS_ON;
577 }
578
579 int
580 main(__UNUSED__ int argc, __UNUSED__ char *argv[])
581 {
582    E_DBus_Connection *c;
583    int total;
584
585    ecore_init();
586    e_dbus_init();
587    eina_init();
588
589    c = e_dbus_bus_get(DBUS_BUS_SYSTEM);
590    if (!c) {
591       printf("ERROR: can't connect to system session\n");
592       return -1;
593    }
594
595    e_connman_system_init(c);
596    ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_ADD, _on_element_add, NULL);
597    ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_DEL, _on_element_del, NULL);
598    ecore_event_handler_add(E_CONNMAN_EVENT_ELEMENT_UPDATED,
599                            _on_element_updated, NULL);
600
601    _exiter_reschedule();
602
603    ecore_main_loop_begin();
604
605    e_dbus_connection_close(c);
606    eina_stringshare_dump();
607    eina_shutdown();
608    e_dbus_shutdown();
609    ecore_shutdown();
610
611    total = success + failure;
612    if (total == 0)
613      fputs("DBG: clean exit, no tests executed.\n", stderr);
614    else
615      fprintf(stderr, "DBG: clean exit, success: %d, failure: %d, %d%%\n",
616              success, failure, (success * 100) / total);
617
618    return 0;
619 }