diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-12 16:14:45 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2018-11-12 16:15:06 +0000 |
commit | 88fab00d4402af240c1b7cc2566133aece115488 (patch) | |
tree | 54525f2b8784dd20ce6886b429ef85d24df04532 /test | |
parent | 8d01b9cd70a67cdafd5b965a70420c3bd7fb3f82 (diff) |
New upstream version 18.11-rc2upstream/18.11-rc2
Change-Id: I43ca4edd0747b2dfc38c574ebf3c0aac17d7392c
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/test/test.c | 34 | ||||
-rw-r--r-- | test/test/test_compressdev.c | 26 | ||||
-rw-r--r-- | test/test/test_cryptodev_asym.c | 9 | ||||
-rw-r--r-- | test/test/test_func_reentrancy.c | 60 | ||||
-rw-r--r-- | test/test/test_hash.c | 24 | ||||
-rw-r--r-- | test/test/test_hash_multiwriter.c | 4 |
6 files changed, 92 insertions, 65 deletions
diff --git a/test/test/test.c b/test/test/test.c index ffa9c366..24df6299 100644 --- a/test/test/test.c +++ b/test/test/test.c @@ -75,15 +75,47 @@ do_recursive_call(void) int last_test_result; +#define MAX_EXTRA_ARGS 32 + int main(int argc, char **argv) { #ifdef RTE_LIBRTE_CMDLINE struct cmdline *cl; #endif + char *extra_args; int ret; - ret = rte_eal_init(argc, argv); + extra_args = getenv("DPDK_TEST_PARAMS"); + if (extra_args != NULL && strlen(extra_args) > 0) { + char **all_argv; + char *eargv[MAX_EXTRA_ARGS]; + int all_argc; + int eargc; + int i; + + RTE_LOG(INFO, APP, "Using additional DPDK_TEST_PARAMS: '%s'\n", + extra_args); + eargc = rte_strsplit(extra_args, strlen(extra_args), + eargv, MAX_EXTRA_ARGS, ' '); + + /* merge argc/argv and the environment args */ + all_argc = argc + eargc; + all_argv = malloc(sizeof(*all_argv) * (all_argc + 1)); + if (all_argv == NULL) + return -1; + + for (i = 0; i < argc; i++) + all_argv[i] = argv[i]; + for (i = 0; i < eargc; i++) + all_argv[argc + i] = eargv[i]; + all_argv[all_argc] = NULL; + + /* call eal_init with combined args */ + ret = rte_eal_init(all_argc, all_argv); + free(all_argv); + } else + ret = rte_eal_init(argc, argv); if (ret < 0) { ret = -1; goto out; diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c index 86453882..5d5e5190 100644 --- a/test/test/test_compressdev.c +++ b/test/test/test_compressdev.c @@ -10,6 +10,7 @@ #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_compressdev.h> +#include <rte_string_fns.h> #include "test_compressdev_test_buffer.h" #include "test.h" @@ -856,13 +857,20 @@ test_deflate_comp_decomp(const char * const test_bufs[], &compress_xforms[xform_idx]->compress; enum rte_comp_huffman huffman_type = compress_xform->deflate.huffman; - RTE_LOG(DEBUG, USER1, "Buffer %u compressed from %u to %u bytes " - "(level = %d, huffman = %s)\n", - buf_idx[priv_data->orig_idx], + char engine[22]; + if (zlib_dir == ZLIB_COMPRESS || zlib_dir == ZLIB_ALL) + strlcpy(engine, "zlib (direct, no pmd)", 22); + else + strlcpy(engine, "pmd", 22); + + RTE_LOG(DEBUG, USER1, "Buffer %u compressed by %s from %u to" + " %u bytes (level = %d, huffman = %s)\n", + buf_idx[priv_data->orig_idx], engine, ops_processed[i]->consumed, ops_processed[i]->produced, compress_xform->level, huffman_type_strings[huffman_type]); - RTE_LOG(DEBUG, USER1, "Compression ratio = %.2f", + RTE_LOG(DEBUG, USER1, "Compression ratio = %.2f\n", + ops_processed[i]->consumed == 0 ? 0 : (float)ops_processed[i]->produced / ops_processed[i]->consumed * 100); ops[i] = NULL; @@ -1058,8 +1066,14 @@ test_deflate_comp_decomp(const char * const test_bufs[], for (i = 0; i < num_bufs; i++) { priv_data = (struct priv_op_data *)(ops_processed[i] + 1); - RTE_LOG(DEBUG, USER1, "Buffer %u decompressed from %u to %u bytes\n", - buf_idx[priv_data->orig_idx], + char engine[22]; + if (zlib_dir == ZLIB_DECOMPRESS || zlib_dir == ZLIB_ALL) + strlcpy(engine, "zlib (direct, no pmd)", 22); + else + strlcpy(engine, "pmd", 22); + RTE_LOG(DEBUG, USER1, + "Buffer %u decompressed by %s from %u to %u bytes\n", + buf_idx[priv_data->orig_idx], engine, ops_processed[i]->consumed, ops_processed[i]->produced); ops[i] = NULL; } diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c index 2fdfc1df..a899f997 100644 --- a/test/test/test_cryptodev_asym.c +++ b/test/test/test_cryptodev_asym.c @@ -153,10 +153,13 @@ test_rsa_sign_verify(void) goto error_exit; } status = TEST_SUCCESS; - int ret = 0; - ret = rsa_verify(&rsaplaintext, result_op); - if (ret) + if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); status = TEST_FAILED; + goto error_exit; + } error_exit: diff --git a/test/test/test_func_reentrancy.c b/test/test/test_func_reentrancy.c index a0ed19d7..e27d1e02 100644 --- a/test/test/test_func_reentrancy.c +++ b/test/test/test_func_reentrancy.c @@ -45,13 +45,14 @@ typedef int (*case_func_t)(void* arg); typedef void (*case_clean_t)(unsigned lcore_id); #define MAX_STRING_SIZE (256) -#define MAX_ITER_TIMES (16) -#define MAX_LPM_ITER_TIMES (8) +#define MAX_ITER_MULTI (16) +#define MAX_ITER_ONCE (4) +#define MAX_LPM_ITER_TIMES (6) #define MEMPOOL_ELT_SIZE (sizeof(uint32_t)) #define MEMPOOL_SIZE (4) -#define MAX_LCORES RTE_MAX_MEMZONE / (MAX_ITER_TIMES * 4U) +#define MAX_LCORES (RTE_MAX_MEMZONE / (MAX_ITER_MULTI * 4U)) static rte_atomic32_t obj_count = RTE_ATOMIC32_INIT(0); static rte_atomic32_t synchro = RTE_ATOMIC32_INIT(0); @@ -88,7 +89,7 @@ ring_clean(unsigned int lcore_id) char ring_name[MAX_STRING_SIZE]; int i; - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_id, i); rp = rte_ring_lookup(ring_name); @@ -108,25 +109,22 @@ ring_create_lookup(__attribute__((unused)) void *arg) WAIT_SYNCHRO_FOR_SLAVES(); /* create the same ring simultaneously on all threads */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_ONCE; i++) { rp = rte_ring_create("fr_test_once", 4096, SOCKET_ID_ANY, 0); if (rp != NULL) rte_atomic32_inc(&obj_count); } /* create/lookup new ring several times */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i); rp = rte_ring_create(ring_name, 4096, SOCKET_ID_ANY, 0); if (NULL == rp) return -1; if (rte_ring_lookup(ring_name) != rp) return -1; - } - /* verify all ring created successful */ - for (i = 0; i < MAX_ITER_TIMES; i++) { - snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i); + /* verify all ring created successful */ if (rte_ring_lookup(ring_name) == NULL) return -1; } @@ -151,7 +149,7 @@ mempool_clean(unsigned int lcore_id) int i; /* verify all ring created successful */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_id, i); mp = rte_mempool_lookup(mempool_name); @@ -171,7 +169,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg) WAIT_SYNCHRO_FOR_SLAVES(); /* create the same mempool simultaneously on all threads */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_ONCE; i++) { mp = rte_mempool_create("fr_test_once", MEMPOOL_SIZE, MEMPOOL_ELT_SIZE, 0, 0, NULL, NULL, @@ -182,7 +180,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg) } /* create/lookup new ring several times */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i); mp = rte_mempool_create(mempool_name, MEMPOOL_SIZE, MEMPOOL_ELT_SIZE, 0, 0, @@ -193,11 +191,8 @@ mempool_create_lookup(__attribute__((unused)) void *arg) return -1; if (rte_mempool_lookup(mempool_name) != mp) return -1; - } - /* verify all ring created successful */ - for (i = 0; i < MAX_ITER_TIMES; i++) { - snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i); + /* verify all ring created successful */ if (rte_mempool_lookup(mempool_name) == NULL) return -1; } @@ -213,7 +208,7 @@ hash_clean(unsigned lcore_id) struct rte_hash *handle; int i; - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_id, i); if ((handle = rte_hash_find_existing(hash_name)) != NULL) @@ -241,14 +236,14 @@ hash_create_free(__attribute__((unused)) void *arg) /* create the same hash simultaneously on all threads */ hash_params.name = "fr_test_once"; - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_ONCE; i++) { handle = rte_hash_create(&hash_params); if (handle != NULL) rte_atomic32_inc(&obj_count); } /* create mutiple times simultaneously */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i); hash_params.name = hash_name; @@ -261,12 +256,8 @@ hash_create_free(__attribute__((unused)) void *arg) return -1; rte_hash_free(handle); - } - - /* verify free correct */ - for (i = 0; i < MAX_ITER_TIMES; i++) { - snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i); + /* verify free correct */ if (NULL != rte_hash_find_existing(hash_name)) return -1; } @@ -281,7 +272,7 @@ fbk_clean(unsigned lcore_id) struct rte_fbk_hash_table *handle; int i; - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_id, i); if ((handle = rte_fbk_hash_find_existing(fbk_name)) != NULL) @@ -309,14 +300,14 @@ fbk_create_free(__attribute__((unused)) void *arg) /* create the same fbk hash table simultaneously on all threads */ fbk_params.name = "fr_test_once"; - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_ONCE; i++) { handle = rte_fbk_hash_create(&fbk_params); if (handle != NULL) rte_atomic32_inc(&obj_count); } /* create mutiple fbk tables simultaneously */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_MULTI; i++) { snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i); fbk_params.name = fbk_name; @@ -329,12 +320,8 @@ fbk_create_free(__attribute__((unused)) void *arg) return -1; rte_fbk_hash_free(handle); - } - - /* verify free correct */ - for (i = 0; i < MAX_ITER_TIMES; i++) { - snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i); + /* verify free correct */ if (NULL != rte_fbk_hash_find_existing(fbk_name)) return -1; } @@ -375,7 +362,7 @@ lpm_create_free(__attribute__((unused)) void *arg) WAIT_SYNCHRO_FOR_SLAVES(); /* create the same lpm simultaneously on all threads */ - for (i = 0; i < MAX_ITER_TIMES; i++) { + for (i = 0; i < MAX_ITER_ONCE; i++) { lpm = rte_lpm_create("fr_test_once", SOCKET_ID_ANY, &config); if (lpm != NULL) rte_atomic32_inc(&obj_count); @@ -393,11 +380,8 @@ lpm_create_free(__attribute__((unused)) void *arg) return -1; rte_lpm_free(lpm); - } - /* verify free correct */ - for (i = 0; i < MAX_LPM_ITER_TIMES; i++) { - snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i); + /* verify free correct */ if (NULL != rte_lpm_find_existing(lpm_name)) return -1; } diff --git a/test/test/test_hash.c b/test/test/test_hash.c index 6d06eb24..fe607fad 100644 --- a/test/test/test_hash.c +++ b/test/test/test_hash.c @@ -80,29 +80,23 @@ static uint32_t pseudo_hash(__attribute__((unused)) const void *keys, return 3; } +#define UNIT_TEST_HASH_VERBOSE 0 /* * Print out result of unit test hash operation. */ -#if defined(UNIT_TEST_HASH_VERBOSE) static void print_key_info(const char *msg, const struct flow_key *key, int32_t pos) { - uint8_t *p = (uint8_t *)key; - unsigned i; - - printf("%s key:0x", msg); - for (i = 0; i < sizeof(struct flow_key); i++) { - printf("%02X", p[i]); + if (UNIT_TEST_HASH_VERBOSE) { + const uint8_t *p = (const uint8_t *)key; + unsigned int i; + + printf("%s key:0x", msg); + for (i = 0; i < sizeof(struct flow_key); i++) + printf("%02X", p[i]); + printf(" @ pos %d\n", pos); } - printf(" @ pos %d\n", pos); -} -#else -static void print_key_info(__attribute__((unused)) const char *msg, - __attribute__((unused)) const struct flow_key *key, - __attribute__((unused)) int32_t pos) -{ } -#endif /* Keys used by unit test functions */ static struct flow_key keys[5] = { { diff --git a/test/test/test_hash_multiwriter.c b/test/test/test_hash_multiwriter.c index d447f6dc..50018db5 100644 --- a/test/test/test_hash_multiwriter.c +++ b/test/test/test_hash_multiwriter.c @@ -39,8 +39,8 @@ struct { struct rte_hash *h; } tbl_multiwriter_test_params; -const uint32_t nb_entries = 16*1024*1024; -const uint32_t nb_total_tsx_insertion = 15*1024*1024; +const uint32_t nb_entries = 5*1024*1024; +const uint32_t nb_total_tsx_insertion = 4.5*1024*1024; uint32_t rounded_nb_total_tsx_insertion; static rte_atomic64_t gcycles; |