Skip to content

Commit 8c4861d

Browse files
committed
test/hash: reduce time of functional R/W test
When running on limited platforms like GitHub Actions, the functional unit test "hash_readwrite_func_autotest" will hit a timeout, especially when running with UBSan: 46/102 DPDK:fast-tests / hash_readwrite_func_autotest TIMEOUT 30.01s killed by signal 15 SIGTERM Similarly to what was done in the commit fd368e1 ("test/hash: test more corner cases"), some constants are decreased. In order to keep the performance test as it was, a multiplier is kept for performance test case only. Signed-off-by: Thomas Monjalon <[email protected]> Acked-by: David Marchand <[email protected]>
1 parent 77e23b2 commit 8c4861d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

app/test/test_hash_readwrite.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818

1919
#define RTE_RWTEST_FAIL 0
2020

21-
#define TOTAL_ENTRY (5*1024*1024)
22-
#define TOTAL_INSERT (4.5*1024*1024)
23-
#define TOTAL_INSERT_EXT (5*1024*1024)
21+
#define TOTAL_ENTRY (5*1024) /* must be multiplied for perf test */
22+
#define TOTAL_INSERT_FUNC (4.5*1024)
23+
#define TOTAL_INSERT_FUNC_EXT (5*1024)
24+
#define PERF_MULTIPLIER 1024
25+
#define TOTAL_INSERT (TOTAL_INSERT_FUNC * PERF_MULTIPLIER) /* only for perf */
2426

2527
#define NUM_TEST 3
2628
unsigned int core_cnt[NUM_TEST] = {2, 4, 8};
@@ -136,16 +138,15 @@ test_hash_readwrite_worker(__rte_unused void *arg)
136138
}
137139

138140
static int
139-
init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
141+
init_params(int use_ext, int use_htm, int rw_lf, int use_jhash, bool perf)
140142
{
141143
unsigned int i;
142-
143144
uint32_t *keys = NULL;
144145
uint8_t *found = NULL;
145146
struct rte_hash *handle;
146147

147148
struct rte_hash_parameters hash_params = {
148-
.entries = TOTAL_ENTRY,
149+
.entries = TOTAL_ENTRY * (perf ? PERF_MULTIPLIER : 1),
149150
.key_len = sizeof(uint32_t),
150151
.hash_func_init_val = 0,
151152
.socket_id = rte_socket_id(),
@@ -182,14 +183,13 @@ init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
182183
}
183184

184185
tbl_rw_test_param.h = handle;
185-
keys = rte_malloc(NULL, sizeof(uint32_t) * TOTAL_ENTRY, 0);
186-
186+
keys = rte_malloc(NULL, sizeof(uint32_t) * hash_params.entries, 0);
187187
if (keys == NULL) {
188188
printf("RTE_MALLOC failed\n");
189189
goto err;
190190
}
191191

192-
found = rte_zmalloc(NULL, sizeof(uint8_t) * TOTAL_ENTRY, 0);
192+
found = rte_zmalloc(NULL, sizeof(uint8_t) * hash_params.entries, 0);
193193
if (found == NULL) {
194194
printf("RTE_ZMALLOC failed\n");
195195
goto err;
@@ -198,7 +198,7 @@ init_params(int use_ext, int use_htm, int rw_lf, int use_jhash)
198198
tbl_rw_test_param.keys = keys;
199199
tbl_rw_test_param.found = found;
200200

201-
for (i = 0; i < TOTAL_ENTRY; i++)
201+
for (i = 0; i < hash_params.entries; i++)
202202
keys[i] = i;
203203

204204
return 0;
@@ -227,13 +227,13 @@ test_hash_readwrite_functional(int use_htm, int use_rw_lf, int use_ext)
227227
rte_atomic_store_explicit(&gcycles, 0, rte_memory_order_relaxed);
228228
rte_atomic_store_explicit(&ginsertions, 0, rte_memory_order_relaxed);
229229

230-
if (init_params(use_ext, use_htm, use_rw_lf, use_jhash) != 0)
230+
if (init_params(use_ext, use_htm, use_rw_lf, use_jhash, false) != 0)
231231
goto err;
232232

233233
if (use_ext)
234-
tot_insert = TOTAL_INSERT_EXT;
234+
tot_insert = TOTAL_INSERT_FUNC_EXT;
235235
else
236-
tot_insert = TOTAL_INSERT;
236+
tot_insert = TOTAL_INSERT_FUNC;
237237

238238
tbl_rw_test_param.num_insert =
239239
tot_insert / worker_cnt;
@@ -390,7 +390,7 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
390390
rte_atomic_store_explicit(&gread_cycles, 0, rte_memory_order_relaxed);
391391
rte_atomic_store_explicit(&gwrite_cycles, 0, rte_memory_order_relaxed);
392392

393-
if (init_params(0, use_htm, 0, use_jhash) != 0)
393+
if (init_params(0, use_htm, 0, use_jhash, true) != 0)
394394
goto err;
395395

396396
/*
@@ -548,7 +548,7 @@ test_hash_readwrite_perf(struct perf *perf_results, int use_htm,
548548
rte_eal_mp_wait_lcore();
549549

550550
iter = 0;
551-
memset(tbl_rw_test_param.found, 0, TOTAL_ENTRY);
551+
memset(tbl_rw_test_param.found, 0, TOTAL_ENTRY * PERF_MULTIPLIER);
552552
while (rte_hash_iterate(tbl_rw_test_param.h,
553553
&next_key, &next_data, &iter) >= 0) {
554554
/* Search for the key in the list of keys added .*/

0 commit comments

Comments
 (0)