test/security: introduce security lib tests
[dpdk.git] / app / test / test_security.c
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
3  */
4
5 #include <rte_errno.h>
6 #include <rte_log.h>
7 #include <rte_memory.h>
8 #include <rte_mempool.h>
9 #include <rte_security.h>
10 #include <rte_security_driver.h>
11
12 /* Before including rte_test.h file you can define
13  * RTE_TEST_TRACE_FAILURE(_file, _line, _func) macro to better trace/debug test
14  * failures. Mostly useful in development phase.
15  */
16 #ifndef RTE_TEST_TRACE_FAILURE
17 #define RTE_TEST_TRACE_FAILURE(_file, _line, _func) \
18         RTE_LOG(DEBUG, EAL, "in %s:%d %s\n", _file, _line, _func)
19 #endif
20
21 #include <rte_test.h>
22 #include "test.h"
23
24 /**
25  * Security
26  * =======
27  *
28  * Basic unit tests of the librte_security API.
29  *
30  * Structure of the file:
31  * - macros for making tests more readable;
32  * - mockup structures and functions for rte_security_ops;
33  * - test suite and test cases setup and teardown functions;
34  * - tests functions;
35  * - declaration of testcases.
36  */
37
38
39 /**
40  * Macros
41  *
42  * Set of macros for making tests easier to read.
43  */
44
45 /**
46  * Verify condition inside mocked up function.
47  * Mockup function cannot return a test error, so the failure
48  * of assertion increases counter and print logs.
49  * The counter can be verified later to check if test case should fail.
50  *
51  * @param   fail_counter        fail counter
52  * @param   cond        condition expected to be true
53  * @param   msg printf style formatting string for custom message
54  */
55 #define MOCK_TEST_ASSERT(fail_counter, cond, msg, ...) do {             \
56         if (!(cond)) {                                                  \
57                 fail_counter++;                                         \
58                 RTE_LOG(DEBUG, EAL, "Test assert %s line %d failed: "   \
59                                 msg "\n", __func__, __LINE__,           \
60                                  ##__VA_ARGS__);                        \
61                 RTE_TEST_TRACE_FAILURE(__FILE__, __LINE__, __func__);   \
62         }                                                               \
63 } while (0)
64
65 /**
66  * Verify equality condition inside mocked up function.
67  * Mockup function cannot return a test error, so the failure
68  * of assertion increases counter and print logs.
69  * The counter can be verified later to check if test case should fail.
70  *
71  * @param   fail_counter        fail counter
72  * @param   a   first value of comparison
73  * @param   b   second value of comparison
74  * @param   msg printf style formatting string for custom message
75  */
76 #define MOCK_TEST_ASSERT_EQUAL(fail_counter, a, b, msg, ...)    \
77         MOCK_TEST_ASSERT(fail_counter, (a) == (b), msg, ##__VA_ARGS__)
78
79
80 /**
81  * Verify if parameter of the mocked up function matches expected value.
82  * The expected value is stored in data structure in the field matching
83  * parameter name.
84  *
85  * @param   data        structure with expected values
86  * @param   parameter   name of the parameter (both field and parameter name)
87  * @param   spec        printf style spec for parameter
88  */
89 #define MOCK_TEST_ASSERT_PARAMETER(data, parameter, spec)               \
90         MOCK_TEST_ASSERT_EQUAL(data.failed, data.parameter, parameter,  \
91                         "Expecting parameter %s to be " spec            \
92                         " but it's " spec, RTE_STR(parameter),          \
93                         data.parameter, parameter)
94
95 /**
96  * Wrap for MOCK_TEST_ASSERT_PARAMETER macro for pointer type parameters.
97  *
98  * @param   data        structure with expected values
99  * @param   parameter   name of the parameter (both field and parameter name)
100  */
101 #define MOCK_TEST_ASSERT_POINTER_PARAMETER(data, parameter)     \
102         MOCK_TEST_ASSERT_PARAMETER(data, parameter, "%p")
103
104 /**
105  * Verify number of calls of the mocked up function
106  * and check if there were any fails during execution.
107  * The fails statistics inside mocked up functions are collected
108  * as "failed" field in mockup structures.
109  *
110  * @param   mock_data   structure with statistics (called, failed)
111  * @param   exp_calls   expected number of mockup function calls
112  */
113 #define TEST_ASSERT_MOCK_CALLS(mock_data, exp_calls) do {               \
114         TEST_ASSERT_EQUAL(exp_calls, mock_data.called,                  \
115                         "Expecting sub op to be called %d times, "      \
116                         "but it's called %d times",                     \
117                         exp_calls, mock_data.called);                   \
118         TEST_ASSERT_EQUAL(0, mock_data.failed,                          \
119                         "Expecting sub op asserts not to fail, "        \
120                         "but they're failed %d times",                  \
121                         mock_data.failed);                              \
122 } while (0)
123
124 /**
125  * Assert tested function result match expected value
126  *
127  * @param   f_name      name of tested function
128  * @param   f_ret       value returned by the function
129  * @param   exp_ret     expected returned value
130  * @param   fmt         printf style format for returned value
131  */
132 #define TEST_ASSERT_MOCK_FUNCTION_CALL_RET(f_name, f_ret, exp_ret, fmt) \
133         TEST_ASSERT_EQUAL(exp_ret, f_ret, "Expecting " RTE_STR(f_name)  \
134                         " to return " fmt ", but it returned " fmt      \
135                         "\n", exp_ret, f_ret)
136
137 /**
138  * Assert tested function result is not NULL
139  *
140  * @param   f_name      name of tested function
141  * @param   f_ret       value returned by the function
142  */
143 #define TEST_ASSERT_MOCK_FUNCTION_CALL_NOT_NULL(f_name, f_ret)          \
144         TEST_ASSERT_NOT_NULL(f_ret, "Expecting " RTE_STR(f_name)        \
145                         " to return not NULL\n")
146
147 /**
148  * Verify that sess_cnt counter value matches expected
149  *
150  * @param   expected_sessions_count     expected counter value
151  */
152 #define TEST_ASSERT_SESSION_COUNT(expected_sessions_count) do {         \
153         struct security_unittest_params *ut_params = &unittest_params;  \
154         TEST_ASSERT_EQUAL(expected_sessions_count,                      \
155                         ut_params->ctx.sess_cnt,                        \
156                         "Expecting session counter to be %u,"           \
157                         " but it's %u", expected_sessions_count,        \
158                         ut_params->ctx.sess_cnt);                       \
159 } while (0)
160
161 /**
162  * Verify usage of mempool by checking if number of allocated objects matches
163  * expectations. The mempool is used to manage objects for sessions data.
164  * A single object is acquired from mempool during session_create
165  * and put back in session_destroy.
166  *
167  * @param   expected_mempool_usage      expected number of used mempool objects
168  */
169 #define TEST_ASSERT_MEMPOOL_USAGE(expected_mempool_usage) do {          \
170         struct security_testsuite_params *ts_params = &testsuite_params;\
171         unsigned int mempool_usage;                                     \
172         mempool_usage = rte_mempool_in_use_count(                       \
173                         ts_params->session_mpool);                      \
174         TEST_ASSERT_EQUAL(expected_mempool_usage, mempool_usage,        \
175                         "Expecting %u mempool allocations, "            \
176                         "but there are %u allocated objects",           \
177                         expected_mempool_usage, mempool_usage);         \
178 } while (0)
179
180
181 /**
182  * Mockup structures and functions for rte_security_ops;
183  *
184  * Set of structures for controlling mockup functions calls.
185  * Every mockup function X has its corresponding X_data structure
186  * and an instance of that structure X_exp.
187  * Structure contains parameters that a mockup function is expected
188  * to be called with, a value to return (.ret) and 2 statistics:
189  * .called (number of times the mockup function was called)
190  * and .failed (number of assertion fails during mockup function call).
191  *
192  * Mockup functions verify that the parameters they are called with match
193  * expected values. The expected values should be stored in corresponding
194  * structures prior to mockup functions call. Every failure of such
195  * verification increases .failed counter. Every call of mockup function
196  * increases .called counter. Function returns value stored in .ret field
197  * of the structure.
198  * In case of some parameters in some functions the expected value is unknown
199  * and cannot be detrmined prior to call. Such parameters are stored
200  * in structure and can be compared or analyzed later in test case code.
201  *
202  * Below structures and functions follow the rules just described.
203  * Additional remarks and exceptions are added in comments.
204  */
205
206 /**
207  * session_create mockup
208  *
209  * Verified parameters: device, conf, mp.
210  * Saved, not verified parameters: sess.
211  */
212 static struct mock_session_create_data {
213         void *device;
214         struct rte_security_session_conf *conf;
215         struct rte_security_session *sess;
216         struct rte_mempool *mp;
217
218         int ret;
219
220         int called;
221         int failed;
222 } mock_session_create_exp = {NULL, NULL, NULL, NULL, 0, 0, 0};
223
224 static int
225 mock_session_create(void *device,
226                 struct rte_security_session_conf *conf,
227                 struct rte_security_session *sess,
228                 struct rte_mempool *mp)
229 {
230         mock_session_create_exp.called++;
231
232         MOCK_TEST_ASSERT_POINTER_PARAMETER(mock_session_create_exp, device);
233         MOCK_TEST_ASSERT_POINTER_PARAMETER(mock_session_create_exp, conf);
234         MOCK_TEST_ASSERT_POINTER_PARAMETER(mock_session_create_exp, mp);
235
236         mock_session_create_exp.sess = sess;
237
238         return mock_session_create_exp.ret;
239 }
240
241 /**
242  * session_destroy mockup
243  *
244  * Verified parameters: device, sess.
245  */
246 static struct mock_session_destroy_data {
247         void *device;
248         struct rte_security_session *sess;
249
250         int ret;
251
252         int called;
253         int failed;
254 } mock_session_destroy_exp = {NULL, NULL, 0, 0, 0};
255
256 static int
257 mock_session_destroy(void *device, struct rte_security_session *sess)
258 {
259         mock_session_destroy_exp.called++;
260
261         MOCK_TEST_ASSERT_POINTER_PARAMETER(mock_session_destroy_exp, device);
262         MOCK_TEST_ASSERT_POINTER_PARAMETER(mock_session_destroy_exp, sess);
263
264         return mock_session_destroy_exp.ret;
265 }
266
267 /**
268  * empty_ops
269  *
270  * is an empty security operations set (all function pointers set to NULL)
271  */
272 struct rte_security_ops empty_ops = { NULL };
273
274 /**
275  * mock_ops
276  *
277  * is a security operations set using mockup functions
278  */
279 struct rte_security_ops mock_ops = {
280         .session_create = mock_session_create,
281         .session_destroy = mock_session_destroy,
282 };
283
284
285 /**
286  * Test suite and test cases setup and teardown functions.
287  */
288
289 /**
290  * struct security_testsuite_params defines parameters initialized once
291  * for whole tests suite.
292  * Currently the only stored parameter is session_mpool a mempool created
293  * once in testsuite_setup and released in testsuite_teardown.
294  * The instance of this structure is stored in testsuite_params variable.
295  */
296 static struct security_testsuite_params {
297         struct rte_mempool *session_mpool;
298 } testsuite_params = { NULL };
299
300 /**
301  * struct security_unittest_params defines parameters initialized
302  * for every test case. The parameters are initialized in ut_setup
303  * and released in ut_teardown.
304  * The instance of this structure is stored in unittest_params variable.
305  */
306 static struct security_unittest_params {
307         struct rte_security_ctx ctx;
308         struct rte_security_session_conf conf;
309         struct rte_security_session *sess;
310 } unittest_params = {
311         .ctx = {
312                 .device = NULL,
313                 .ops = &mock_ops,
314                 .sess_cnt = 0,
315         },
316         .sess = NULL,
317 };
318
319 #define SECURITY_TEST_MEMPOOL_NAME "SecurityTestsMempoolName"
320 #define SECURITY_TEST_MEMPOOL_SIZE 15
321 #define SECURITY_TEST_SESSION_OBJECT_SIZE sizeof(struct rte_security_session)
322
323 /**
324  * testsuite_setup initializes whole test suite parameters.
325  * It creates a new mempool used in all test cases
326  * and verifies if it properly created.
327  */
328 static int
329 testsuite_setup(void)
330 {
331         struct security_testsuite_params *ts_params = &testsuite_params;
332         ts_params->session_mpool = rte_mempool_create(
333                         SECURITY_TEST_MEMPOOL_NAME,
334                         SECURITY_TEST_MEMPOOL_SIZE,
335                         SECURITY_TEST_SESSION_OBJECT_SIZE,
336                         0, 0, NULL, NULL, NULL, NULL,
337                         SOCKET_ID_ANY, 0);
338         TEST_ASSERT_NOT_NULL(ts_params->session_mpool,
339                         "Cannot create mempool %s\n", rte_strerror(rte_errno));
340         return TEST_SUCCESS;
341 }
342
343 /**
344  * testsuite_teardown releases test suite wide parameters.
345  */
346 static void
347 testsuite_teardown(void)
348 {
349         struct security_testsuite_params *ts_params = &testsuite_params;
350         if (ts_params->session_mpool) {
351                 rte_mempool_free(ts_params->session_mpool);
352                 ts_params->session_mpool = NULL;
353         }
354 }
355
356 /**
357  * ut_setup initializes test case parameters to default values.
358  * It resets also any .called and .failed statistics of mockup functions
359  * usage.
360  */
361 static int
362 ut_setup(void)
363 {
364         struct security_unittest_params *ut_params = &unittest_params;
365         ut_params->ctx.device = NULL;
366         ut_params->ctx.ops = &mock_ops;
367         ut_params->ctx.sess_cnt = 0;
368         ut_params->sess = NULL;
369
370         mock_session_create_exp.called = 0;
371         mock_session_destroy_exp.called = 0;
372
373         mock_session_create_exp.failed = 0;
374         mock_session_destroy_exp.failed = 0;
375
376         return TEST_SUCCESS;
377 }
378
379 /**
380  * destroy_session_with_check is a helper function releasing session
381  * created with rte_security_session_create and stored in test case parameters.
382  * It's used both to release sessions created in test cases' bodies
383  * which are assigned to ut_params->sess
384  */
385 static int
386 destroy_session_with_check(void)
387 {
388         struct security_unittest_params *ut_params = &unittest_params;
389         if (ut_params->sess != NULL) {
390                 /* Assure that mockup function for destroy operation is set. */
391                 ut_params->ctx.ops = &mock_ops;
392
393                 mock_session_destroy_exp.device = NULL;
394                 mock_session_destroy_exp.sess = ut_params->sess;
395                 mock_session_destroy_exp.ret = 0;
396                 mock_session_destroy_exp.called = 0;
397                 mock_session_destroy_exp.failed = 0;
398
399                 int ret = rte_security_session_destroy(&ut_params->ctx,
400                                 ut_params->sess);
401                 TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_destroy,
402                                 ret, 0, "%d");
403                 TEST_ASSERT_MOCK_CALLS(mock_session_destroy_exp, 1);
404
405                 ut_params->sess = NULL;
406         }
407         return TEST_SUCCESS;
408 }
409
410 /**
411  * ut_teardown releases test case parameters.
412  */
413 static void
414 ut_teardown(void)
415 {
416         destroy_session_with_check();
417 }
418
419
420 /**
421  * Test functions
422  *
423  * Each test function is related to a single test case.
424  * They are arranged by tested rte_security API function
425  * and by rte_security execution paths sequence in code.
426  */
427
428 /**
429  * rte_security_session_create tests
430  */
431
432 /**
433  * Test execution of rte_security_session_create with NULL instance
434  */
435 static int
436 test_session_create_inv_context(void)
437 {
438         struct security_testsuite_params *ts_params = &testsuite_params;
439         struct security_unittest_params *ut_params = &unittest_params;
440         struct rte_security_session *sess;
441
442         sess = rte_security_session_create(NULL, &ut_params->conf,
443                         ts_params->session_mpool);
444         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
445                         sess, NULL, "%p");
446         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
447         TEST_ASSERT_MEMPOOL_USAGE(0);
448         TEST_ASSERT_SESSION_COUNT(0);
449
450         return TEST_SUCCESS;
451 }
452
453 /**
454  * Test execution of rte_security_session_create with invalid
455  * security operations structure (NULL)
456  */
457 static int
458 test_session_create_inv_context_ops(void)
459 {
460         struct security_testsuite_params *ts_params = &testsuite_params;
461         struct security_unittest_params *ut_params = &unittest_params;
462         struct rte_security_session *sess;
463
464         ut_params->ctx.ops = NULL;
465
466         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
467                         ts_params->session_mpool);
468         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
469                         sess, NULL, "%p");
470         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
471         TEST_ASSERT_MEMPOOL_USAGE(0);
472         TEST_ASSERT_SESSION_COUNT(0);
473
474         return TEST_SUCCESS;
475 }
476
477 /**
478  * Test execution of rte_security_session_create with empty
479  * security operations
480  */
481 static int
482 test_session_create_inv_context_ops_fun(void)
483 {
484         struct security_testsuite_params *ts_params = &testsuite_params;
485         struct security_unittest_params *ut_params = &unittest_params;
486         struct rte_security_session *sess;
487
488         ut_params->ctx.ops = &empty_ops;
489
490         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
491                         ts_params->session_mpool);
492         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
493                         sess, NULL, "%p");
494         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
495         TEST_ASSERT_MEMPOOL_USAGE(0);
496         TEST_ASSERT_SESSION_COUNT(0);
497
498         return TEST_SUCCESS;
499 }
500
501 /**
502  * Test execution of rte_security_session_create with NULL conf parameter
503  */
504 static int
505 test_session_create_inv_configuration(void)
506 {
507         struct security_testsuite_params *ts_params = &testsuite_params;
508         struct security_unittest_params *ut_params = &unittest_params;
509         struct rte_security_session *sess;
510
511         sess = rte_security_session_create(&ut_params->ctx, NULL,
512                         ts_params->session_mpool);
513         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
514                         sess, NULL, "%p");
515         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
516         TEST_ASSERT_MEMPOOL_USAGE(0);
517         TEST_ASSERT_SESSION_COUNT(0);
518
519         return TEST_SUCCESS;
520 }
521
522 /**
523  * Test execution of rte_security_session_create with NULL mp parameter
524  */
525 static int
526 test_session_create_inv_mempool(void)
527 {
528         struct security_unittest_params *ut_params = &unittest_params;
529         struct rte_security_session *sess;
530
531         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
532                         NULL);
533         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
534                         sess, NULL, "%p");
535         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
536         TEST_ASSERT_MEMPOOL_USAGE(0);
537         TEST_ASSERT_SESSION_COUNT(0);
538
539         return TEST_SUCCESS;
540 }
541
542 /**
543  * Test execution of rte_security_session_create in case when mempool
544  * is fully used and no object can be got from it
545  */
546 static int
547 test_session_create_mempool_empty(void)
548 {
549         struct security_testsuite_params *ts_params = &testsuite_params;
550         struct security_unittest_params *ut_params = &unittest_params;
551         struct rte_security_session *tmp[SECURITY_TEST_MEMPOOL_SIZE];
552         struct rte_security_session *sess;
553
554         /* Get all available objects from mempool. */
555         int i, ret;
556         for (i = 0; i < SECURITY_TEST_MEMPOOL_SIZE; ++i) {
557                 ret = rte_mempool_get(ts_params->session_mpool,
558                                 (void **)(&tmp[i]));
559                 TEST_ASSERT_EQUAL(0, ret,
560                                 "Expect getting %d object from mempool"
561                                 " to succeed", i);
562         }
563         TEST_ASSERT_MEMPOOL_USAGE(SECURITY_TEST_MEMPOOL_SIZE);
564
565         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
566                         ts_params->session_mpool);
567         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
568                         sess, NULL, "%p");
569         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 0);
570         TEST_ASSERT_MEMPOOL_USAGE(SECURITY_TEST_MEMPOOL_SIZE);
571         TEST_ASSERT_SESSION_COUNT(0);
572
573         /* Put objects back to the pool. */
574         for (i = 0; i < SECURITY_TEST_MEMPOOL_SIZE; ++i)
575                 rte_mempool_put(ts_params->session_mpool, (void *)(tmp[i]));
576         TEST_ASSERT_MEMPOOL_USAGE(0);
577
578         return TEST_SUCCESS;
579 }
580
581 /**
582  * Test execution of rte_security_session_create when session_create
583  * security operation fails
584  */
585 static int
586 test_session_create_ops_failure(void)
587 {
588         struct security_testsuite_params *ts_params = &testsuite_params;
589         struct security_unittest_params *ut_params = &unittest_params;
590         struct rte_security_session *sess;
591
592         mock_session_create_exp.device = NULL;
593         mock_session_create_exp.conf = &ut_params->conf;
594         mock_session_create_exp.mp = ts_params->session_mpool;
595         mock_session_create_exp.ret = -1;       /* Return failure status. */
596
597         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
598                         ts_params->session_mpool);
599         TEST_ASSERT_MOCK_FUNCTION_CALL_RET(rte_security_session_create,
600                         sess, NULL, "%p");
601         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 1);
602         TEST_ASSERT_MEMPOOL_USAGE(0);
603         TEST_ASSERT_SESSION_COUNT(0);
604
605         return TEST_SUCCESS;
606 }
607
608 /**
609  * Test execution of rte_security_session_create in successful execution path
610  */
611 static int
612 test_session_create_success(void)
613 {
614         struct security_testsuite_params *ts_params = &testsuite_params;
615         struct security_unittest_params *ut_params = &unittest_params;
616         struct rte_security_session *sess;
617
618         mock_session_create_exp.device = NULL;
619         mock_session_create_exp.conf = &ut_params->conf;
620         mock_session_create_exp.mp = ts_params->session_mpool;
621         mock_session_create_exp.ret = 0;        /* Return success status. */
622
623         sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf,
624                         ts_params->session_mpool);
625         TEST_ASSERT_MOCK_FUNCTION_CALL_NOT_NULL(rte_security_session_create,
626                         sess);
627         TEST_ASSERT_EQUAL(sess, mock_session_create_exp.sess,
628                         "Expecting session_create to be called with %p sess"
629                         " parameter, but it's called %p sess parameter",
630                         sess, mock_session_create_exp.sess);
631         TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 1);
632         TEST_ASSERT_MEMPOOL_USAGE(1);
633         TEST_ASSERT_SESSION_COUNT(1);
634
635         /*
636          * Store created session in test case parameters, so it can be released
637          * after test case in ut_teardown by destroy_session_with_check.
638          */
639         ut_params->sess = sess;
640
641         return TEST_SUCCESS;
642 }
643
644
645 /**
646  * Declaration of testcases
647  */
648 static struct unit_test_suite security_testsuite  = {
649         .suite_name = "generic security",
650         .setup = testsuite_setup,
651         .teardown = testsuite_teardown,
652         .unit_test_cases = {
653                 TEST_CASE_ST(ut_setup, ut_teardown,
654                                 test_session_create_inv_context),
655                 TEST_CASE_ST(ut_setup, ut_teardown,
656                                 test_session_create_inv_context_ops),
657                 TEST_CASE_ST(ut_setup, ut_teardown,
658                                 test_session_create_inv_context_ops_fun),
659                 TEST_CASE_ST(ut_setup, ut_teardown,
660                                 test_session_create_inv_configuration),
661                 TEST_CASE_ST(ut_setup, ut_teardown,
662                                 test_session_create_inv_mempool),
663                 TEST_CASE_ST(ut_setup, ut_teardown,
664                                 test_session_create_mempool_empty),
665                 TEST_CASE_ST(ut_setup, ut_teardown,
666                                 test_session_create_ops_failure),
667                 TEST_CASE_ST(ut_setup, ut_teardown,
668                                 test_session_create_success),
669
670                 TEST_CASES_END() /**< NULL terminate unit test array */
671         }
672 };
673
674 static int
675 test_security(void)
676 {
677         rte_log_set_global_level(RTE_LOG_DEBUG);
678         rte_log_set_level(RTE_LOGTYPE_EAL, RTE_LOG_DEBUG);
679
680         return unit_test_suite_runner(&security_testsuite);
681 }
682
683 REGISTER_TEST_COMMAND(security_autotest, test_security);