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