service: return integer service id from register
[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,
164                         rte_service_component_register(&service, NULL),
165                         "Invalid callback");
166         service.callback = dummy_cb;
167
168         TEST_ASSERT_EQUAL(-EINVAL,
169                         rte_service_component_register(&service, NULL),
170                         "Invalid name");
171         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
172
173         TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),
174                         "Failed to register valid service");
175
176         return TEST_SUCCESS;
177 }
178
179 /* verify get_by_name() service lookup */
180 static int
181 service_get_by_name(void)
182 {
183         unregister_all();
184
185         /* ensure with no services registered returns NULL */
186         TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
187                         "Service get by name should return NULL");
188
189         /* register service */
190         struct rte_service_spec service;
191         memset(&service, 0, sizeof(struct rte_service_spec));
192         TEST_ASSERT_EQUAL(-EINVAL,
193                         rte_service_component_register(&service, NULL),
194                         "Invalid callback");
195         service.callback = dummy_cb;
196         TEST_ASSERT_EQUAL(-EINVAL,
197                         rte_service_component_register(&service, NULL),
198                         "Invalid name");
199         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
200         TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),
201                         "Failed to register valid service");
202
203         /* ensure with dummy services registered returns same ptr as ID */
204         struct rte_service_spec *s_by_id = rte_service_get_by_id(0);
205         TEST_ASSERT_EQUAL(s_by_id, rte_service_get_by_name(DUMMY_SERVICE_NAME),
206                         "Service get_by_name should equal get_by_id()");
207
208         unregister_all();
209
210         /* ensure after unregister, get_by_name returns NULL */
211         TEST_ASSERT_EQUAL(0, rte_service_get_by_name(DUMMY_SERVICE_NAME),
212                         "get by name should return NULL after unregister");
213
214         return TEST_SUCCESS;
215 }
216
217 /* verify probe of capabilities */
218 static int
219 service_probe_capability(void)
220 {
221         unregister_all();
222
223         struct rte_service_spec service;
224         memset(&service, 0, sizeof(struct rte_service_spec));
225         service.callback = dummy_cb;
226         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
227         service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
228         TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),
229                         "Register of MT SAFE service failed");
230
231         /* verify flag is enabled */
232         const uint32_t sid = 0;
233         int32_t mt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE);
234         TEST_ASSERT_EQUAL(1, mt, "MT SAFE capability flag not set.");
235
236
237         unregister_all();
238
239         memset(&service, 0, sizeof(struct rte_service_spec));
240         service.callback = dummy_cb;
241         snprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);
242         TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),
243                         "Register of non-MT safe service failed");
244
245         /* verify flag is enabled */
246         mt = rte_service_probe_capability(sid, RTE_SERVICE_CAP_MT_SAFE);
247         TEST_ASSERT_EQUAL(0, mt, "MT SAFE cap flag set on non MT SAFE service");
248
249         return unregister_all();
250 }
251
252 /* verify the service name */
253 static int
254 service_name(void)
255 {
256         struct rte_service_spec *service = rte_service_get_by_id(0);
257
258         int equal = strcmp(service->name, DUMMY_SERVICE_NAME);
259         TEST_ASSERT_EQUAL(0, equal, "Error: Service name not correct");
260
261         return unregister_all();
262 }
263
264 /* verify service dump */
265 static int
266 service_dump(void)
267 {
268         struct rte_service_spec *service = rte_service_get_by_id(0);
269         rte_service_set_stats_enable(service, 1);
270         rte_service_dump(stdout, service);
271         rte_service_set_stats_enable(service, 0);
272         rte_service_dump(stdout, service);
273         return unregister_all();
274 }
275
276 /* start and stop a service */
277 static int
278 service_start_stop(void)
279 {
280         const uint32_t sid = 0;
281         struct rte_service_spec *s = rte_service_get_by_id(0);
282
283         /* runstate_get() returns if service is running and slcore is mapped */
284         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
285                         "Service core add did not return zero");
286         int ret = rte_service_map_lcore_set(sid, slcore_id, 1);
287         TEST_ASSERT_EQUAL(0, ret,
288                         "Enabling service core, expected 0 got %d", ret);
289
290         TEST_ASSERT_EQUAL(0, rte_service_is_running(s),
291                         "Error: Service should be stopped");
292
293         TEST_ASSERT_EQUAL(0, rte_service_stop(s),
294                         "Error: Service stopped returned non-zero");
295
296         TEST_ASSERT_EQUAL(0, rte_service_is_running(s),
297                         "Error: Service is running - should be stopped");
298
299         TEST_ASSERT_EQUAL(0, rte_service_start(s),
300                         "Error: Service start returned non-zero");
301
302         TEST_ASSERT_EQUAL(1, rte_service_is_running(s),
303                         "Error: Service is not running");
304
305         return unregister_all();
306 }
307
308
309 static int
310 service_remote_launch_func(void *arg)
311 {
312         RTE_SET_USED(arg);
313         service_remote_launch_flag = 1;
314         return 0;
315 }
316
317 /* enable and disable a lcore for a service */
318 static int
319 service_lcore_en_dis_able(void)
320 {
321         const uint32_t sid = 0;
322
323         /* expected failure cases */
324         TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 1),
325                         "Enable on invalid core did not fail");
326         TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 0),
327                         "Disable on invalid core did not fail");
328
329         /* add service core to allow enabling */
330         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
331                         "Add service core failed when not in use before");
332
333         /* valid enable */
334         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1),
335                         "Enabling valid service and core failed");
336         TEST_ASSERT_EQUAL(1, rte_service_map_lcore_get(sid, slcore_id),
337                         "Enabled core returned not-enabled");
338
339         /* valid disable */
340         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 0),
341                         "Disabling valid service and lcore failed");
342         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_get(sid, slcore_id),
343                         "Disabled core returned enabled");
344
345         /* call remote_launch to verify that app can launch ex-service lcore */
346         service_remote_launch_flag = 0;
347         int ret = rte_eal_remote_launch(service_remote_launch_func, NULL,
348                                         slcore_id);
349         TEST_ASSERT_EQUAL(0, ret, "Ex-service core remote launch failed.");
350         rte_eal_mp_wait_lcore();
351         TEST_ASSERT_EQUAL(1, service_remote_launch_flag,
352                         "Ex-service core function call had no effect.");
353
354         return unregister_all();
355 }
356
357 static int
358 service_lcore_running_check(void)
359 {
360         uint64_t tick = service_tick;
361         rte_delay_ms(SERVICE_DELAY * 10);
362         /* if (tick != service_tick) we know the lcore as polled the service */
363         return tick != service_tick;
364 }
365
366 static int
367 service_lcore_add_del(void)
368 {
369         /* check initial count */
370         TEST_ASSERT_EQUAL(0, rte_service_lcore_count(),
371                         "Service lcore count has value before adding a lcore");
372
373         /* check service lcore add */
374         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
375                         "Add service core failed when not in use before");
376         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_add(slcore_id),
377                         "Add service core failed to refuse in-use lcore");
378
379         /* check count */
380         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
381                         "Service core count not equal to one");
382
383         /* retrieve core list, checking lcore ids */
384         const uint32_t size = 4;
385         uint32_t service_core_ids[size];
386         int32_t n = rte_service_lcore_list(service_core_ids, size);
387         TEST_ASSERT_EQUAL(1, n, "Service core list return should equal 1");
388         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
389                                 "Service core list lcore must equal slcore_id");
390
391         /* recheck count, add more cores, and check count */
392         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
393                         "Service core count not equal to one");
394         uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
395                                                /* skip master */ 1,
396                                                /* wrap */ 0);
397         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
398                         "Service core add did not return zero");
399         uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
400                                                /* skip master */ 1,
401                                                /* wrap */ 0);
402         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
403                         "Service core add did not return zero");
404
405         uint32_t count = rte_service_lcore_count();
406         const uint32_t cores_at_this_point = 3;
407         TEST_ASSERT_EQUAL(cores_at_this_point, count,
408                         "Service core count %d, expected %d", count,
409                         cores_at_this_point);
410
411         /* check longer service core list */
412         n = rte_service_lcore_list(service_core_ids, size);
413         TEST_ASSERT_EQUAL(3, n, "Service core list return should equal 3");
414         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
415                                 "Service core list[0] lcore must equal 1");
416         TEST_ASSERT_EQUAL(slcore_1, service_core_ids[1],
417                                 "Service core list[1] lcore must equal 2");
418         TEST_ASSERT_EQUAL(slcore_2, service_core_ids[2],
419                                 "Service core list[2] lcore must equal 3");
420
421         /* recheck count, remove lcores, check remaining lcore_id is correct */
422         TEST_ASSERT_EQUAL(3, rte_service_lcore_count(),
423                         "Service core count not equal to three");
424         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_1),
425                         "Service core add did not return zero");
426         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_2),
427                         "Service core add did not return zero");
428         TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
429                         "Service core count not equal to one");
430         n = rte_service_lcore_list(service_core_ids, size);
431         TEST_ASSERT_EQUAL(1, n, "Service core list return should equal one");
432         TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
433                                 "Service core list[0] lcore must equal %d",
434                                 slcore_id);
435
436         return unregister_all();
437 }
438
439 static int
440 service_threaded_test(int mt_safe)
441 {
442         unregister_all();
443
444         /* add next 2 cores */
445         uint32_t slcore_1 = rte_get_next_lcore(/* start core */ -1,
446                                                /* skip master */ 1,
447                                                /* wrap */ 0);
448         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_1),
449                         "mt safe lcore add fail");
450         uint32_t slcore_2 = rte_get_next_lcore(/* start core */ slcore_1,
451                                                /* skip master */ 1,
452                                                /* wrap */ 0);
453         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_2),
454                         "mt safe lcore add fail");
455
456         /* Use atomic locks to verify that two threads are in the same function
457          * at the same time. These are passed to the unit tests through the
458          * callback userdata parameter
459          */
460         uint32_t test_params[2];
461         memset(test_params, 0, sizeof(uint32_t) * 2);
462
463         /* register MT safe service. */
464         struct rte_service_spec service;
465         memset(&service, 0, sizeof(struct rte_service_spec));
466         service.callback_userdata = test_params;
467         snprintf(service.name, sizeof(service.name), MT_SAFE_SERVICE_NAME);
468
469         if (mt_safe) {
470                 service.callback = dummy_mt_safe_cb;
471                 service.capabilities |= RTE_SERVICE_CAP_MT_SAFE;
472         } else {
473                 /* initialize to pass, see callback comment for details */
474                 test_params[1] = 1;
475                 service.callback = dummy_mt_unsafe_cb;
476         }
477
478         TEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),
479                         "Register of MT SAFE service failed");
480
481         struct rte_service_spec *s = rte_service_get_by_id(0);
482         const uint32_t sid = 0;
483         TEST_ASSERT_EQUAL(0, rte_service_start(s),
484                         "Starting valid service failed");
485         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_1, 1),
486                         "Failed to enable lcore 1 on mt safe service");
487         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_2, 1),
488                         "Failed to enable lcore 2 on mt safe service");
489         rte_service_lcore_start(slcore_1);
490         rte_service_lcore_start(slcore_2);
491
492         /* wait for the worker threads to run */
493         rte_delay_ms(500);
494         rte_service_lcore_stop(slcore_1);
495         rte_service_lcore_stop(slcore_2);
496
497         TEST_ASSERT_EQUAL(1, test_params[1],
498                         "MT Safe service not run by two cores concurrently");
499
500         TEST_ASSERT_EQUAL(0, rte_service_stop(s),
501                         "Failed to stop MT Safe service");
502
503         unregister_all();
504
505         /* return the value of the callback pass_test variable to caller */
506         return test_params[1];
507 }
508
509 /* tests an MT SAFE service with two cores. The callback function ensures that
510  * two threads access the callback concurrently.
511  */
512 static int
513 service_mt_safe_poll(void)
514 {
515         int mt_safe = 1;
516         TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
517                         "Error: MT Safe service not run by two cores concurrently");
518         return TEST_SUCCESS;
519 }
520
521 /* tests a NON mt safe service with two cores, the callback is serialized
522  * using the atomic cmpset.
523  */
524 static int
525 service_mt_unsafe_poll(void)
526 {
527         int mt_safe = 0;
528         TEST_ASSERT_EQUAL(1, service_threaded_test(mt_safe),
529                         "Error: NON MT Safe service run by two cores concurrently");
530         return TEST_SUCCESS;
531 }
532
533 /* start and stop a service core - ensuring it goes back to sleep */
534 static int
535 service_lcore_start_stop(void)
536 {
537         /* start service core and service, create mapping so tick() runs */
538         const uint32_t sid = 0;
539         struct rte_service_spec *s = rte_service_get_by_id(0);
540         TEST_ASSERT_EQUAL(0, rte_service_start(s),
541                         "Starting valid service failed");
542         TEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, slcore_id, 1),
543                         "Enabling valid service on non-service core must fail");
544
545         /* core start */
546         TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_start(slcore_id),
547                         "Service core start without add should return EINVAL");
548         TEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),
549                         "Service core add did not return zero");
550         TEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1),
551                         "Enabling valid service on valid core failed");
552         TEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id),
553                         "Service core start after add failed");
554         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_start(slcore_id),
555                         "Service core expected as running but was stopped");
556
557         /* ensures core really is running the service function */
558         TEST_ASSERT_EQUAL(1, service_lcore_running_check(),
559                         "Service core expected to poll service but it didn't");
560
561         /* core stop */
562         TEST_ASSERT_EQUAL(-EINVAL, rte_service_lcore_stop(100000),
563                         "Invalid Service core stop should return -EINVAL");
564         TEST_ASSERT_EQUAL(0, rte_service_lcore_stop(slcore_id),
565                         "Service core stop expected to return 0");
566         TEST_ASSERT_EQUAL(-EALREADY, rte_service_lcore_stop(slcore_id),
567                         "Already stopped service core should return -EALREADY");
568
569         /* ensure service is not longer running */
570         TEST_ASSERT_EQUAL(0, service_lcore_running_check(),
571                         "Service core expected to poll service but it didn't");
572
573         TEST_ASSERT_EQUAL(0, rte_service_lcore_del(slcore_id),
574                         "Service core del did not return zero");
575
576         return unregister_all();
577 }
578
579 static struct unit_test_suite service_tests  = {
580         .suite_name = "service core test suite",
581         .setup = testsuite_setup,
582         .teardown = testsuite_teardown,
583         .unit_test_cases = {
584                 TEST_CASE_ST(dummy_register, NULL, unregister_all),
585                 TEST_CASE_ST(dummy_register, NULL, service_name),
586                 TEST_CASE_ST(dummy_register, NULL, service_get_by_name),
587                 TEST_CASE_ST(dummy_register, NULL, service_dump),
588                 TEST_CASE_ST(dummy_register, NULL, service_probe_capability),
589                 TEST_CASE_ST(dummy_register, NULL, service_start_stop),
590                 TEST_CASE_ST(dummy_register, NULL, service_lcore_add_del),
591                 TEST_CASE_ST(dummy_register, NULL, service_lcore_start_stop),
592                 TEST_CASE_ST(dummy_register, NULL, service_lcore_en_dis_able),
593                 TEST_CASE_ST(dummy_register, NULL, service_mt_unsafe_poll),
594                 TEST_CASE_ST(dummy_register, NULL, service_mt_safe_poll),
595                 TEST_CASES_END() /**< NULL terminate unit test array */
596         }
597 };
598
599 static int
600 test_service_common(void)
601 {
602         return unit_test_suite_runner(&service_tests);
603 }
604
605 REGISTER_TEST_COMMAND(service_autotest, test_service_common);