88fac8f44e2bf72555a3f41988d5740d6a5b2a5e
[deb_dpdk.git] / test / test / test_service_cores.c
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2017 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include <rte_common.h>
34 #include <rte_hexdump.h>
35 #include <rte_mbuf.h>
36 #include <rte_malloc.h>
37 #include <rte_memcpy.h>
38 #include <rte_cycles.h>
39
40 #include <rte_service.h>
41 #include <rte_service_component.h>
42
43 #include "test.h"
44
45 /* used as the service core ID */
46 static uint32_t slcore_id;
47 /* used as timestamp to detect if a service core is running */
48 static uint64_t service_tick;
49 /* used as a flag to check if a function was run */
50 static uint32_t service_remote_launch_flag;
51
52 #define SERVICE_DELAY 1
53
54 #define DUMMY_SERVICE_NAME "dummy_service"
55 #define MT_SAFE_SERVICE_NAME "mt_safe_service"
56
57 static int
58 testsuite_setup(void)
59 {
60         slcore_id = rte_get_next_lcore(/* start core */ -1,
61                                        /* skip master */ 1,
62                                        /* wrap */ 0);
63
64         return TEST_SUCCESS;
65 }
66
67 static void
68 testsuite_teardown(void)
69 {
70         /* release service cores? */
71 }
72
73 static int32_t dummy_cb(void *args)
74 {
75         RTE_SET_USED(args);
76         service_tick++;
77         rte_delay_ms(SERVICE_DELAY);
78         return 0;
79 }
80
81 static int32_t dummy_mt_unsafe_cb(void *args)
82 {
83         /* before running test, the initialization has set pass_test to 1.
84          * If the cmpset in service-cores is working correctly, the code here
85          * should never fail to take the lock. If the lock *is* taken, fail the
86          * test, because two threads are concurrently in a non-MT safe callback.
87          */
88         uint32_t *test_params = args;
89         uint32_t *atomic_lock = &test_params[0];
90         uint32_t *pass_test = &test_params[1];
91         int lock_taken = rte_atomic32_cmpset(atomic_lock, 0, 1);
92         if (lock_taken) {
93                 /* delay with the lock held */
94                 rte_delay_ms(250);
95                 rte_atomic32_clear((rte_atomic32_t *)atomic_lock);
96         } else {
97                 /* 2nd thread will fail to take lock, so set pass flag */
98                 *pass_test = 0;
99         }
100
101         return 0;
102 }
103
104
105 static int32_t dummy_mt_safe_cb(void *args)
106 {
107         /* Atomic checks to ensure MT safe services allow > 1 thread to
108          * concurrently run the callback. The concept is as follows;
109          * 1) if lock is available, take the lock then delay
110          * 2) if first lock is taken, and a thread arrives in the CB, we know
111          *    that 2 threads are running the callback at the same time: MT safe
112          */
113         uint32_t *test_params = args;
114         uint32_t *atomic_lock = &test_params[0];
115         uint32_t *pass_test = &test_params[1];
116         int lock_taken = rte_atomic32_cmpset(atomic_lock, 0, 1);
117         if (lock_taken) {
118                 /* delay with the lock held */
119                 rte_delay_ms(250);
120                 rte_atomic32_clear((rte_atomic32_t *)atomic_lock);
121         } else {
122                 /* 2nd thread will fail to take lock, so set pass flag */
123                 *pass_test = 1;
124         }
125
126         return 0;
127 }
128
129 /* unregister all services */
130 static int
131 unregister_all(void)
132 {
133         uint32_t i;
134         struct rte_service_spec *dead = (struct rte_service_spec *)0xdead;
135
136         TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(0),
137                         "Unregistered NULL pointer");
138         TEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(dead),
139                         "Unregistered invalid pointer");
140
141         uint32_t c = rte_service_get_count();
142         for (i = 0; i < c; i++) {
143                 struct rte_service_spec *s = rte_service_get_by_id(i);
144                 TEST_ASSERT_EQUAL(0, rte_service_unregister(s),
145                                 "Error unregistering a valid service");
146         }
147
148         rte_service_lcore_reset_all();
149
150         return TEST_SUCCESS;
151 }
152
153 /* register a single dummy service */
154 static int
155 dummy_register(void)
156 {
157         /* make sure there are no remains from previous tests */
158         unregister_all();
159
160         struct rte_service_spec service;
161         memset(&service, 0, sizeof(struct rte_service_spec));
162
163         TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
164                         "Invalid callback");
165         service.callback = dummy_cb;
166
167         TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
168                         "Invalid name");
169         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
170
171         TEST_ASSERT_EQUAL(0, rte_service_register(&service),
172                         "Failed to register valid service");
173
174         return TEST_SUCCESS;
175 }
176
177 /* verify get_by_name() service lookup */
178 static int
179 service_get_by_name(void)
180 {
181         unregister_all();
182
183         /* ensure with no services registered returns NULL */
184         TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
185                         "Service get by name should return NULL");
186
187         /* register service */
188         struct rte_service_spec service;
189         memset(&service, 0, sizeof(struct rte_service_spec));
190         TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
191                         "Invalid callback");
192         service.callback = dummy_cb;
193         TEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),
194                         "Invalid name");
195         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
196         TEST_ASSERT_EQUAL(0, rte_service_register(&service),
197                         "Failed to register valid service");
198
199         /* ensure with dummy services registered returns same ptr as ID */
200         struct rte_service_spec *s_by_id = rte_service_get_by_id(0);
201         TEST_ASSERT_EQUAL(s_by_id, rte_service_get_by_name(DUMMY_SERVICE_NAME),
202                         "Service get_by_name should equal get_by_id()");
203
204         unregister_all();
205
206         /* ensure after unregister, get_by_name returns NULL */
207         TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
208                         "get by name should return NULL after unregister");
209
210         return TEST_SUCCESS;
211 }
212
213 /* verify probe of capabilities */
214 static int
215 service_probe_capability(void)
216 {
217         unregister_all();
218
219         struct rte_service_spec service;
220         memset(&service, 0, sizeof(struct rte_service_spec));
221         service.callback = dummy_cb;
222         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
223         service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
224         TEST_ASSERT_EQUAL(0, rte_service_register(&service),
225                         "Register of MT SAFE service failed");
226
227         /* verify flag is enabled */
228         struct rte_service_spec *s = rte_service_get_by_id(0);
229         int32_t mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);
230         TEST_ASSERT_EQUAL(1, mt, "MT SAFE capability flag not set.");
231
232
233         unregister_all();
234
235         memset(&service, 0, sizeof(struct rte_service_spec));
236         service.callback = dummy_cb;
237         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
238         TEST_ASSERT_EQUAL(0, rte_service_register(&service),
239                         "Register of non-MT safe service failed");
240
241         /* verify flag is enabled */
242         s = rte_service_get_by_id(0);
243         mt = rte_service_probe_capability(s, RTE_SERVICE_CAP_MT_SAFE);
244         TEST_ASSERT_EQUAL(0, mt, "MT SAFE cap flag set on non MT SAFE service");
245
246         return unregister_all();
247 }
248
249 /* verify the service name */
250 static int
251 service_name(void)
252 {
253         struct rte_service_spec *service = rte_service_get_by_id(0);
254
255         int equal = strcmp(service->name, DUMMY_SERVICE_NAME);
256         TEST_ASSERT_EQUAL(0, equal, "Error: Service name not correct");
257
258         return unregister_all();
259 }
260
261 /* verify service dump */
262 static int
263 service_dump(void)
264 {
265         struct rte_service_spec *service = rte_service_get_by_id(0);
266         rte_service_set_stats_enable(service, 1);
267         rte_service_dump(stdout, service);
268         rte_service_set_stats_enable(service, 0);
269         rte_service_dump(stdout, service);
270         return unregister_all();
271 }
272
273 /* start and stop a service */
274 static int
275 service_start_stop(void)
276 {
277         struct rte_service_spec *service = rte_service_get_by_id(0);
278
279         /* is_running() returns if service is running and slcore is mapped */
280         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
281                         "Service core add did not return zero");
282         int ret = rte_service_enable_on_lcore(service, slcore_id);
283         TEST_ASSERT_EQUAL(0, ret,
284                         "Enabling service core, expected 0 got %d", ret);
285
286         TEST_ASSERT_EQUAL(0, rte_service_is_running(service),
287                         "Error: Service should be stopped");
288
289         TEST_ASSERT_EQUAL(0, rte_service_stop(service),
290                         "Error: Service stopped returned non-zero");
291
292         TEST_ASSERT_EQUAL(0, rte_service_is_running(service),
293                         "Error: Service is running - should be stopped");
294
295         TEST_ASSERT_EQUAL(0, rte_service_start(service),
296                         "Error: Service start returned non-zero");
297
298         TEST_ASSERT_EQUAL(1, rte_service_is_running(service),
299                         "Error: Service is not running");
300
301         return unregister_all();
302 }
303
304
305 static int
306 service_remote_launch_func(void *arg)
307 {
308         RTE_SET_USED(arg);
309         service_remote_launch_flag = 1;
310         return 0;
311 }
312
313 /* enable and disable a lcore for a service */
314 static int
315 service_lcore_en_dis_able(void)
316 {
317         struct rte_service_spec *s = rte_service_get_by_id(0);
318
319         /* expected failure cases */
320         TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, 100000),
321                         "Enable on invalid core did not fail");
322         TEST_ASSERT_EQUAL(-EINVAL, rte_service_disable_on_lcore(s, 100000),
323                         "Disable on invalid core did not fail");
324
325         /* add service core to allow enabling */
326         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
327                         "Add service core failed when not in use before");
328
329         /* valid enable */
330         TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),
331                         "Enabling valid service and core failed");
332         TEST_ASSERT_EQUAL(1, rte_service_get_enabled_on_lcore(s, slcore_id),
333                         "Enabled core returned not-enabled");
334
335         /* valid disable */
336         TEST_ASSERT_EQUAL(0, rte_service_disable_on_lcore(s, slcore_id),
337                         "Disabling valid service and lcore failed");
338         TEST_ASSERT_EQUAL(0, rte_service_get_enabled_on_lcore(s, slcore_id),
339                         "Disabled core returned enabled");
340
341         /* call remote_launch to verify that app can launch ex-service lcore */
342         service_remote_launch_flag = 0;
343         int ret = rte_eal_remote_launch(service_remote_launch_func, NULL,
344                                         slcore_id);
345         TEST_ASSERT_EQUAL(0, ret, "Ex-service core remote launch failed.");
346         rte_eal_mp_wait_lcore();
347         TEST_ASSERT_EQUAL(1, service_remote_launch_flag,
348                         "Ex-service core function call had no effect.");
349
350         return unregister_all();
351 }
352
353 static int
354 service_lcore_running_check(void)
355 {
356         uint64_t tick = service_tick;
357         rte_delay_ms(SERVICE_DELAY * 10);
358         /* if (tick != service_tick) we know the lcore as polled the service */
359         return tick != service_tick;
360 }
361
362 static int
363 service_lcore_add_del(void)
364 {
365         /* check initial count */
366         TEST_ASSERT_EQUAL(0, rte_service_lcore_count(),
367                         "Service lcore count has value before adding a lcore");
368
369         /* check service lcore add */
370         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
371                         "Add service core failed when not in use before");
372         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_add(slcore_id),
373                         "Add service core failed to refuse in-use lcore");
374
375         /* check count */
376         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
377                         "Service core count not equal to one");
378
379         /* retrieve core list, checking lcore ids */
380         const uint32_t size = 4;
381         uint32_t service_core_ids[size];
382         int32_t n = rte_service_lcore_list(service_core_ids, size);
383         TEST_ASSERT_EQUAL(1, n, "Service core list return should equal 1");
384         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
385                                 "Service core list lcore must equal slcore_id");
386
387         /* recheck count, add more cores, and check count */
388         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
389                         "Service core count not equal to one");
390         uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
391                                                /* skip master */ 1,
392                                                /* wrap */ 0);
393         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
394                         "Service core add did not return zero");
395         uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
396                                                /* skip master */ 1,
397                                                /* wrap */ 0);
398         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
399                         "Service core add did not return zero");
400
401         uint32_t count = rte_service_lcore_count();
402         const uint32_t cores_at_this_point = 3;
403         TEST_ASSERT_EQUAL(cores_at_this_point, count,
404                         "Service core count %d, expected %d", count,
405                         cores_at_this_point);
406
407         /* check longer service core list */
408         n = rte_service_lcore_list(service_core_ids, size);
409         TEST_ASSERT_EQUAL(3, n, "Service core list return should equal 3");
410         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
411                                 "Service core list[0] lcore must equal 1");
412         TEST_ASSERT_EQUAL(slcore_1, service_core_ids[1],
413                                 "Service core list[1] lcore must equal 2");
414         TEST_ASSERT_EQUAL(slcore_2, service_core_ids[2],
415                                 "Service core list[2] lcore must equal 3");
416
417         /* recheck count, remove lcores, check remaining lcore_id is correct */
418         TEST_ASSERT_EQUAL(3, rte_service_lcore_count(),
419                         "Service core count not equal to three");
420         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_1),
421                         "Service core add did not return zero");
422         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_2),
423                         "Service core add did not return zero");
424         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
425                         "Service core count not equal to one");
426         n = rte_service_lcore_list(service_core_ids, size);
427         TEST_ASSERT_EQUAL(1, n, "Service core list return should equal one");
428         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
429                                 "Service core list[0] lcore must equal %d",
430                                 slcore_id);
431
432         return unregister_all();
433 }
434
435 static int
436 service_threaded_test(int mt_safe)
437 {
438         unregister_all();
439
440         /* add next 2 cores */
441         uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
442                                                /* skip master */ 1,
443                                                /* wrap */ 0);
444         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
445                         "mt safe lcore add fail");
446         uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
447                                                /* skip master */ 1,
448                                                /* wrap */ 0);
449         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
450                         "mt safe lcore add fail");
451
452         /* Use atomic locks to verify that two threads are in the same function
453          * at the same time. These are passed to the unit tests through the
454          * callback userdata parameter
455          */
456         uint32_t test_params[2];
457         memset(test_params, 0, sizeof(uint32_t) * 2);
458
459         /* register MT safe service. */
460         struct rte_service_spec service;
461         memset(&service, 0, sizeof(struct rte_service_spec));
462         service.callback_userdata = test_params;
463         snprintf(service.name, sizeof(service.name), MT_SAFE_SERVICE_NAME);
464
465         if (mt_safe) {
466                 service.callback = dummy_mt_safe_cb;
467                 service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
468         } else {
469                 /* initialize to pass, see callback comment for details */
470                 test_params[1] = 1;
471                 service.callback = dummy_mt_unsafe_cb;
472         }
473
474         TEST_ASSERT_EQUAL(0, rte_service_register(&service),
475                         "Register of MT SAFE service failed");
476
477         struct rte_service_spec *s = rte_service_get_by_id(0);
478         TEST_ASSERT_EQUAL(0, rte_service_start(s),
479                         "Starting valid service failed");
480         TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_1),
481                         "Failed to enable lcore 1 on mt safe service");
482         TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_2),
483                         "Failed to enable lcore 2 on mt safe service");
484         rte_service_lcore_start(slcore_1);
485         rte_service_lcore_start(slcore_2);
486
487         /* wait for the worker threads to run */
488         rte_delay_ms(500);
489         rte_service_lcore_stop(slcore_1);
490         rte_service_lcore_stop(slcore_2);
491
492         TEST_ASSERT_EQUAL(1, test_params[1],
493                         "MT Safe service not run by two cores concurrently");
494
495         TEST_ASSERT_EQUAL(0, rte_service_stop(s),
496                         "Failed to stop MT Safe service");
497
498         unregister_all();
499
500         /* return the value of the callback pass_test variable to caller */
501         return test_params[1];
502 }
503
504 /* tests an MT SAFE service with two cores. The callback function ensures that
505  * two threads access the callback concurrently.
506  */
507 static int
508 service_mt_safe_poll(void)
509 {
510         int mt_safe = 1;
511         TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
512                         "Error: MT Safe service not run by two cores concurrently");
513         return TEST_SUCCESS;
514 }
515
516 /* tests a NON mt safe service with two cores, the callback is serialized
517  * using the atomic cmpset.
518  */
519 static int
520 service_mt_unsafe_poll(void)
521 {
522         int mt_safe = 0;
523         TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
524                         "Error: NON MT Safe service run by two cores concurrently");
525         return TEST_SUCCESS;
526 }
527
528 /* start and stop a service core - ensuring it goes back to sleep */
529 static int
530 service_lcore_start_stop(void)
531 {
532         /* start service core and service, create mapping so tick() runs */
533         struct rte_service_spec *s = rte_service_get_by_id(0);
534         TEST_ASSERT_EQUAL(0, rte_service_start(s),
535                         "Starting valid service failed");
536         TEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, slcore_id),
537                         "Enabling valid service on non-service core must fail");
538
539         /* core start */
540         TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_start(slcore_id),
541                         "Service core start without add should return EINVAL");
542         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
543                         "Service core add did not return zero");
544         TEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),
545                         "Enabling valid service on valid core failed");
546         TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id),
547                         "Service core start after add failed");
548         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_start(slcore_id),
549                         "Service core expected as running but was stopped");
550
551         /* ensures core really is running the service function */
552         TEST_ASSERT_EQUAL(1, service_lcore_running_check(),
553                         "Service core expected to poll service but it didn't");
554
555         /* core stop */
556         TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000),
557                         "Invalid Service core stop should return -EINVAL");
558         TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id),
559                         "Service core stop expected to return 0");
560         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_stop(slcore_id),
561                         "Already stopped service core should return -EALREADY");
562
563         /* ensure service is not longer running */
564         TEST_ASSERT_EQUAL(0, service_lcore_running_check(),
565                         "Service core expected to poll service but it didn't");
566
567         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_id),
568                         "Service core del did not return zero");
569
570         return unregister_all();
571 }
572
573 static struct unit_test_suite service_tests  = {
574         .suite_name = "service core test suite",
575         .setup = testsuite_setup,
576         .teardown = testsuite_teardown,
577         .unit_test_cases = {
578                 TEST_CASE_ST(dummy_register, NULL, unregister_all),
579                 TEST_CASE_ST(dummy_register, NULL, service_name),
580                 TEST_CASE_ST(dummy_register, NULL, service_get_by_name),
581                 TEST_CASE_ST(dummy_register, NULL, service_dump),
582                 TEST_CASE_ST(dummy_register, NULL, service_probe_capability),
583                 TEST_CASE_ST(dummy_register, NULL, service_start_stop),
584                 TEST_CASE_ST(dummy_register, NULL, service_lcore_add_del),
585                 TEST_CASE_ST(dummy_register, NULL, service_lcore_start_stop),
586                 TEST_CASE_ST(dummy_register, NULL, service_lcore_en_dis_able),
587                 TEST_CASE_ST(dummy_register, NULL, service_mt_unsafe_poll),
588                 TEST_CASE_ST(dummy_register, NULL, service_mt_safe_poll),
589                 TEST_CASES_END() /**< NULL terminate unit test array */
590         }
591 };
592
593 static int
594 test_service_common(void)
595 {
596         return unit_test_suite_runner(&service_tests);
597 }
598
599 REGISTER_TEST_COMMAND(service_autotest, test_service_common);