* ut_setup_with_session initializes test case parameters by * - calling standard ut_setup, * - creating a session that can be used in test case. */
| 606 | * - creating a session that can be used in test case. |
| 607 | */ |
| 608 | static int |
| 609 | ut_setup_with_session(void) |
| 610 | { |
| 611 | struct security_unittest_params *ut_params = &unittest_params; |
| 612 | struct security_testsuite_params *ts_params = &testsuite_params; |
| 613 | void *sess; |
| 614 | |
| 615 | int ret = ut_setup(); |
| 616 | if (ret != TEST_SUCCESS) |
| 617 | return ret; |
| 618 | |
| 619 | mock_session_create_exp.device = NULL; |
| 620 | mock_session_create_exp.conf = &ut_params->conf; |
| 621 | mock_session_create_exp.mp = ts_params->session_mpool; |
| 622 | mock_session_create_exp.ret = 0; |
| 623 | |
| 624 | sess = rte_security_session_create(&ut_params->ctx, &ut_params->conf, |
| 625 | ts_params->session_mpool); |
| 626 | TEST_ASSERT_MOCK_FUNCTION_CALL_NOT_NULL(rte_security_session_create, |
| 627 | sess); |
| 628 | TEST_ASSERT_EQUAL(sess, mock_session_create_exp.sess, |
| 629 | "Expecting session_create to be called with %p sess" |
| 630 | " parameter, but it's called %p sess parameter", |
| 631 | sess, mock_session_create_exp.sess); |
| 632 | TEST_ASSERT_MOCK_CALLS(mock_session_create_exp, 1); |
| 633 | |
| 634 | /* |
| 635 | * Store created session in test case parameters, so it can be released |
| 636 | * after test case in ut_teardown by destroy_session_with_check. |
| 637 | */ |
| 638 | ut_params->sess = sess; |
| 639 | |
| 640 | return TEST_SUCCESS; |
| 641 | } |
| 642 | |
| 643 | |
| 644 | /** |
nothing calls this directly
no test coverage detected