From patchwork Fri Sep 8 11:58:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aakash Sasidharan X-Patchwork-Id: 131303 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEEB042547; Fri, 8 Sep 2023 13:58:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6352B402D9; Fri, 8 Sep 2023 13:58:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DD1FA402D2 for ; Fri, 8 Sep 2023 13:58:29 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3885BegA020657 for ; Fri, 8 Sep 2023 04:58:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=hjD9j6QQ8HBIq2AEw0itnKnGs3+R3S4WqVMjz0566Co=; b=VMrm59SVy8c/AdU8+MA7O8j27qwv2oH5IvulnEJPbU2SMeVB1Fq3HGzeMWW2FSSc9fH1 iO6eP1ciI8un+aQQD0tZmptr0EJTVaoiipm/ydCGsAbdS25FvZE03HVwJ4Jd/mUhEAKd gla8eqfAm6QCEC5UlXWzXnUppBPnABNtUNrF6SB9MhSdacfL8ZnQJ7Lfvw39ttjcO2Ua 2NYPpzZ/OSVXb4AvKNBEO4ooIcgOivIC/kbZaU1LDhquuzUMnuUECGHQX2ny55ZF1Yxf Sy1aXkPnWe4v8+dpur2lEDQnRdqJ1PO+3CXi+LfZSPXZ1gtLaRp8stMU6PhUPGhx8B7Z Cw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3syk9akber-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Fri, 08 Sep 2023 04:58:28 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Fri, 8 Sep 2023 04:58:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Fri, 8 Sep 2023 04:58:26 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 139665B692E; Fri, 8 Sep 2023 04:58:24 -0700 (PDT) From: Aakash Sasidharan To: Anoob Joseph , Volodymyr Fialko CC: , , Subject: [PATCH 2/3] test/pdcp: add SDAP test cases Date: Fri, 8 Sep 2023 17:28:20 +0530 Message-ID: <20230908115821.3396269-2-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230908115821.3396269-1-asasidharan@marvell.com> References: <20230908115821.3396269-1-asasidharan@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 2PFnw7MWvyjlKW3LxAVgMat9yndAILs5 X-Proofpoint-GUID: 2PFnw7MWvyjlKW3LxAVgMat9yndAILs5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-08_09,2023-09-05_01,2023-05-22_02 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add PDCP SDAP test cases. Signed-off-by: Aakash Sasidharan --- app/test/test_pdcp.c | 438 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 397 insertions(+), 41 deletions(-) diff --git a/app/test/test_pdcp.c b/app/test/test_pdcp.c index 6c73c1db36..9c9e7a51fc 100644 --- a/app/test/test_pdcp.c +++ b/app/test/test_pdcp.c @@ -15,6 +15,7 @@ #include "test.h" #include "test_cryptodev.h" +#include "test_cryptodev_security_pdcp_sdap_test_vectors.h" #include "test_cryptodev_security_pdcp_test_vectors.h" #define NSECPERSEC 1E9 @@ -23,7 +24,8 @@ #define TEST_EV_QUEUE_ID 0 #define TEST_EV_PORT_ID 0 #define CDEV_INVALID_ID UINT8_MAX -#define NB_TESTS RTE_DIM(pdcp_test_params) +#define NB_BASIC_TESTS RTE_DIM(pdcp_test_params) +#define NB_SDAP_TESTS RTE_DIM(list_pdcp_sdap_tests) #define PDCP_IV_LEN 16 /* Assert that condition is true, or goto the mark */ @@ -72,24 +74,71 @@ struct pdcp_test_conf { uint32_t output_len; }; -static int create_test_conf_from_index(const int index, struct pdcp_test_conf *conf); +enum pdcp_test_suite_type { + PDCP_TEST_SUITE_TY_BASIC, + PDCP_TEST_SUITE_TY_SDAP, +}; + +static int create_test_conf_from_index(const int index, struct pdcp_test_conf *conf, + enum pdcp_test_suite_type suite_type); typedef int (*test_with_conf_t)(struct pdcp_test_conf *conf); +static uint32_t +nb_tests_get(enum pdcp_test_suite_type type) +{ + uint32_t ret; + + switch (type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = NB_BASIC_TESTS; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = NB_SDAP_TESTS; + break; + default: + return 0; + } + + return ret; +} + +static const char* +pdcp_test_name_get(enum pdcp_test_suite_type type, int idx) +{ + const char *test_name = NULL; + + switch (type) { + case PDCP_TEST_SUITE_TY_BASIC: + test_name = pdcp_test_params[idx].name; + break; + case PDCP_TEST_SUITE_TY_SDAP: + test_name = list_pdcp_sdap_tests[idx].param.name; + break; + default: + return NULL; + } + + return test_name; +} + static int -run_test_foreach_known_vec(test_with_conf_t test, bool stop_on_first_pass) +run_test_foreach_known_vec(test_with_conf_t test, bool stop_on_first_pass, + enum pdcp_test_suite_type suite_type) { struct pdcp_test_conf test_conf; bool all_tests_skipped = true; + uint32_t nb_tests = nb_tests_get(suite_type); uint32_t i; int ret; - for (i = 0; i < NB_TESTS; i++) { - create_test_conf_from_index(i, &test_conf); + for (i = 0; i < nb_tests; i++) { + create_test_conf_from_index(i, &test_conf, suite_type); ret = test(&test_conf); if (ret == TEST_FAILED) { - printf("[%03i] - %s - failed\n", i, pdcp_test_params[i].name); + printf("[%03i] - %s - failed\n", i, + pdcp_test_name_get(suite_type, i)); return TEST_FAILED; } @@ -113,7 +162,17 @@ run_test_with_all_known_vec(const void *args) { test_with_conf_t test = args; - return run_test_foreach_known_vec(test, false); + return run_test_foreach_known_vec(test, false, + PDCP_TEST_SUITE_TY_BASIC); +} + +static int +run_test_with_all_sdap_known_vec(const void *args) +{ + test_with_conf_t test = args; + + return run_test_foreach_known_vec(test, false, + PDCP_TEST_SUITE_TY_SDAP); } static int @@ -121,7 +180,8 @@ run_test_with_all_known_vec_until_first_pass(const void *args) { test_with_conf_t test = args; - return run_test_foreach_known_vec(test, true); + return run_test_foreach_known_vec(test, true, + PDCP_TEST_SUITE_TY_BASIC); } static inline uint32_t @@ -522,13 +582,296 @@ pdcp_sn_to_raw_set(void *data, uint32_t sn, int size) } } +static uint8_t +pdcp_test_bearer_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_bearer[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].bearer; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + ret = -1; + + } + + return ret; +} + +static enum rte_security_pdcp_domain +pdcp_test_param_domain_get(enum pdcp_test_suite_type suite_type, const int index) +{ + enum rte_security_pdcp_domain ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_params[index].domain; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].param.domain; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + ret = -1; + } + + return ret; +} + +static uint8_t +pdcp_test_data_sn_size_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_data_sn_size[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].sn_size; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + + } + + return ret; +} + +static uint8_t +pdcp_test_packet_direction_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_packet_direction[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].packet_direction; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + } + + return ret; +} + +static enum rte_crypto_cipher_algorithm +pdcp_test_param_cipher_alg_get(enum pdcp_test_suite_type suite_type, const int index) +{ + enum rte_crypto_cipher_algorithm ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_params[index].cipher_alg; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].param.cipher_alg; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return 0; + } + + return ret; +} + +static uint8_t +pdcp_test_param_cipher_key_len_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_params[index].cipher_key_len; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].param.cipher_key_len; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + } + + return ret; +} + +static const uint8_t* +pdcp_test_crypto_key_get(enum pdcp_test_suite_type suite_type, const int index) +{ + const uint8_t *ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_crypto_key[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].cipher_key; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return NULL; + } + + return ret; +} + +static enum rte_crypto_auth_algorithm +pdcp_test_param_auth_alg_get(enum pdcp_test_suite_type suite_type, const int index) +{ + enum rte_crypto_auth_algorithm ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_params[index].auth_alg; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].param.auth_alg; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return 0; + } + + return ret; +} + +static uint8_t +pdcp_test_param_auth_key_len_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_params[index].auth_key_len; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].param.auth_key_len; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + } + + return ret; +} + +static const uint8_t* +pdcp_test_auth_key_get(enum pdcp_test_suite_type suite_type, const int index) +{ + const uint8_t *ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_auth_key[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].auth_key; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return NULL; + } + + return ret; +} + +static const uint8_t* +pdcp_test_data_in_get(enum pdcp_test_suite_type suite_type, const int index) +{ + const uint8_t *ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_data_in[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].data_in; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return NULL; + } + + return ret; +} + +static uint8_t +pdcp_test_data_in_len_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint8_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_data_in_len[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].in_len; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + } + + return ret; +} + +static const uint8_t* +pdcp_test_data_out_get(enum pdcp_test_suite_type suite_type, const int index) +{ + const uint8_t *ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_data_out[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].data_out; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return NULL; + } + + return ret; +} + +static uint32_t +pdcp_test_hfn_get(enum pdcp_test_suite_type suite_type, const int index) +{ + uint32_t ret; + + switch (suite_type) { + case PDCP_TEST_SUITE_TY_BASIC: + ret = pdcp_test_hfn[index]; + break; + case PDCP_TEST_SUITE_TY_SDAP: + ret = list_pdcp_sdap_tests[index].hfn; + break; + default: + RTE_LOG(ERR, USER1, "Invalid suite_type: %d\n", suite_type); + return -1; + } + + return ret; +} + static int -create_test_conf_from_index(const int index, struct pdcp_test_conf *conf) +create_test_conf_from_index(const int index, struct pdcp_test_conf *conf, + enum pdcp_test_suite_type suite_type) { const struct pdcp_testsuite_params *ts_params = &testsuite_params; struct rte_crypto_sym_xform c_xfrm, a_xfrm; + const uint8_t *data, *expected; uint32_t sn, expected_len; - uint8_t *data, *expected; int pdcp_hdr_sz; memset(conf, 0, sizeof(*conf)); @@ -538,41 +881,42 @@ create_test_conf_from_index(const int index, struct pdcp_test_conf *conf) conf->entity.sess_mpool = ts_params->sess_pool; conf->entity.cop_pool = ts_params->cop_pool; conf->entity.ctrl_pdu_pool = ts_params->mbuf_pool; - conf->entity.pdcp_xfrm.bearer = pdcp_test_bearer[index]; + conf->entity.pdcp_xfrm.bearer = pdcp_test_bearer_get(suite_type, index); conf->entity.pdcp_xfrm.en_ordering = 0; conf->entity.pdcp_xfrm.remove_duplicates = 0; - conf->entity.pdcp_xfrm.domain = pdcp_test_params[index].domain; + conf->entity.pdcp_xfrm.domain = pdcp_test_param_domain_get(suite_type, index); conf->entity.t_reordering = t_reorder_timer; - if (pdcp_test_packet_direction[index] == PDCP_DIR_UPLINK) + if (pdcp_test_packet_direction_get(suite_type, index) == PDCP_DIR_UPLINK) conf->entity.pdcp_xfrm.pkt_dir = RTE_SECURITY_PDCP_UPLINK; else conf->entity.pdcp_xfrm.pkt_dir = RTE_SECURITY_PDCP_DOWNLINK; - conf->entity.pdcp_xfrm.sn_size = pdcp_test_data_sn_size[index]; + conf->entity.pdcp_xfrm.sn_size = pdcp_test_data_sn_size_get(suite_type, index); /* Zero initialize unsupported flags */ conf->entity.pdcp_xfrm.hfn_threshold = 0; conf->entity.pdcp_xfrm.hfn_ovrd = 0; - conf->entity.pdcp_xfrm.sdap_enabled = 0; + + conf->entity.pdcp_xfrm.sdap_enabled = (suite_type == PDCP_TEST_SUITE_TY_SDAP); c_xfrm.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - c_xfrm.cipher.algo = pdcp_test_params[index].cipher_alg; - c_xfrm.cipher.key.length = pdcp_test_params[index].cipher_key_len; - c_xfrm.cipher.key.data = pdcp_test_crypto_key[index]; + c_xfrm.cipher.algo = pdcp_test_param_cipher_alg_get(suite_type, index); + c_xfrm.cipher.key.length = pdcp_test_param_cipher_key_len_get(suite_type, index); + c_xfrm.cipher.key.data = pdcp_test_crypto_key_get(suite_type, index); a_xfrm.type = RTE_CRYPTO_SYM_XFORM_AUTH; - if (pdcp_test_params[index].auth_alg == 0) { + if (pdcp_test_param_auth_alg_get(suite_type, index) == 0) { conf->is_integrity_protected = false; } else { - a_xfrm.auth.algo = pdcp_test_params[index].auth_alg; - a_xfrm.auth.key.data = pdcp_test_auth_key[index]; - a_xfrm.auth.key.length = pdcp_test_params[index].auth_key_len; + a_xfrm.auth.algo = pdcp_test_param_auth_alg_get(suite_type, index); + a_xfrm.auth.key.data = pdcp_test_auth_key_get(suite_type, index); + a_xfrm.auth.key.length = pdcp_test_param_auth_key_len_get(suite_type, index); conf->is_integrity_protected = true; } - pdcp_hdr_sz = pdcp_hdr_size_get(pdcp_test_data_sn_size[index]); + pdcp_hdr_sz = pdcp_hdr_size_get(pdcp_test_data_sn_size_get(suite_type, index)); /* * Uplink means PDCP entity is configured for transmit. Downlink means PDCP entity is @@ -640,41 +984,42 @@ create_test_conf_from_index(const int index, struct pdcp_test_conf *conf) conf->entity.dev_id = (uint8_t)cryptodev_id_get(conf->is_integrity_protected, &conf->c_xfrm, &conf->a_xfrm); - if (pdcp_test_params[index].domain == RTE_SECURITY_PDCP_MODE_CONTROL || - pdcp_test_params[index].domain == RTE_SECURITY_PDCP_MODE_DATA) { - data = pdcp_test_data_in[index]; - sn = pdcp_sn_from_raw_get(data, pdcp_test_data_sn_size[index]); - conf->entity.pdcp_xfrm.hfn = pdcp_test_hfn[index]; + if (pdcp_test_param_domain_get(suite_type, index) == RTE_SECURITY_PDCP_MODE_CONTROL || + pdcp_test_param_domain_get(suite_type, index) == RTE_SECURITY_PDCP_MODE_DATA) { + data = pdcp_test_data_in_get(suite_type, index); + sn = pdcp_sn_from_raw_get(data, pdcp_test_data_sn_size_get(suite_type, index)); + conf->entity.pdcp_xfrm.hfn = pdcp_test_hfn_get(suite_type, index); conf->entity.sn = sn; } if (conf->entity.pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK) { #ifdef VEC_DUMP - debug_hexdump(stdout, "Original vector:", pdcp_test_data_in[index], - pdcp_test_data_in_len[index]); + debug_hexdump(stdout, "Original vector:", pdcp_test_data_in_get(suite_type, index), + pdcp_test_data_in_len_get(suite_type, index)); #endif /* Since the vectors available already have PDCP header, trim the same */ - conf->input_len = pdcp_test_data_in_len[index] - pdcp_hdr_sz; - memcpy(conf->input, pdcp_test_data_in[index] + pdcp_hdr_sz, conf->input_len); + conf->input_len = pdcp_test_data_in_len_get(suite_type, index) - pdcp_hdr_sz; + memcpy(conf->input, pdcp_test_data_in_get(suite_type, index) + pdcp_hdr_sz, + conf->input_len); } else { - conf->input_len = pdcp_test_data_in_len[index]; + conf->input_len = pdcp_test_data_in_len_get(suite_type, index); if (conf->is_integrity_protected) conf->input_len += RTE_PDCP_MAC_I_LEN; - memcpy(conf->input, pdcp_test_data_out[index], conf->input_len); + memcpy(conf->input, pdcp_test_data_out_get(suite_type, index), conf->input_len); #ifdef VEC_DUMP debug_hexdump(stdout, "Original vector:", conf->input, conf->input_len); #endif } if (conf->entity.pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK) - expected = pdcp_test_data_out[index]; + expected = pdcp_test_data_out_get(suite_type, index); else - expected = pdcp_test_data_in[index]; + expected = pdcp_test_data_in_get(suite_type, index); /* Calculate expected packet length */ - expected_len = pdcp_test_data_in_len[index]; + expected_len = pdcp_test_data_in_len_get(suite_type, index); /* In DL processing, PDCP header would be stripped */ if (conf->entity.pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) { @@ -1836,7 +2181,7 @@ run_test_for_one_known_vec(const void *arg) struct pdcp_test_conf test_conf; int i = *(const uint32_t *)arg; - create_test_conf_from_index(i, &test_conf); + create_test_conf_from_index(i, &test_conf, PDCP_TEST_SUITE_TY_BASIC); return test_attempt_single(&test_conf); } @@ -1924,8 +2269,18 @@ static struct unit_test_suite status_report_test_cases = { } }; +static struct unit_test_suite sdap_test_cases = { + .suite_name = "PDCP SDAP", + .unit_test_cases = { + TEST_CASE_NAMED_WITH_DATA("SDAP Known vector cases", + ut_setup_pdcp, ut_teardown_pdcp, + run_test_with_all_sdap_known_vec, test_attempt_single), + TEST_CASES_END() /**< NULL terminate unit test array */ + } +}; struct unit_test_suite *test_suites[] = { NULL, /* Place holder for known_vector_cases */ + &sdap_test_cases, &combined_mode_cases, &hfn_sn_test_cases, &reorder_test_cases, @@ -1945,11 +2300,12 @@ static int test_pdcp(void) { struct unit_test_suite *known_vector_cases; - int ret, index[NB_TESTS]; + uint32_t nb_tests = nb_tests_get(PDCP_TEST_SUITE_TY_BASIC); + int ret, index[nb_tests]; uint32_t i, size; size = sizeof(struct unit_test_suite); - size += (NB_TESTS + 1) * sizeof(struct unit_test_case); + size += (nb_tests + 1) * sizeof(struct unit_test_case); known_vector_cases = rte_zmalloc(NULL, size, 0); if (known_vector_cases == NULL) @@ -1957,7 +2313,7 @@ test_pdcp(void) known_vector_cases->suite_name = "Known vector cases"; - for (i = 0; i < NB_TESTS; i++) { + for (i = 0; i < nb_tests; i++) { index[i] = i; known_vector_cases->unit_test_cases[i].name = pdcp_test_params[i].name; known_vector_cases->unit_test_cases[i].data = (void *)&index[i];