Skip to content

Commit ca67d80

Browse files
bastien-curutchetKernel Patches Daemon
authored andcommitted
selftests/bpf: test_xsk: Isolate flaky tests
Some tests are flaky and fail from time to time on virtual interfaces. Adding them to the CI would trigger lots of 'false' errors. Remove the flaky tests from the nominal tests table so they won't be run by the CI in upcoming patch. Create a flaky_tests table to hold them. Use this flaky table in xskxceiver.c to keep all the tests available from the test_xsk.sh script. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 18281bd commit ca67d80

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

tools/testing/selftests/bpf/test_xsk.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ static const struct test_spec tests[] = {
272272
{.name = "XDP_SHARED_UMEM", .test_func = testapp_xdp_shared_umem},
273273
{.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata},
274274
{.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb},
275-
{.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
276275
{.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
277276
.test_func = testapp_send_receive_unaligned_mb},
278277
{.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb},
@@ -282,9 +281,14 @@ static const struct test_spec tests[] = {
282281
{.name = "HW_SW_MAX_RING_SIZE", .test_func = testapp_hw_sw_max_ring_size},
283282
{.name = "XDP_ADJUST_TAIL_SHRINK", .test_func = testapp_adjust_tail_shrink},
284283
{.name = "XDP_ADJUST_TAIL_SHRINK_MULTI_BUFF", .test_func = testapp_adjust_tail_shrink_mb},
285-
{.name = "XDP_ADJUST_TAIL_GROW", .test_func = testapp_adjust_tail_grow},
286284
{.name = "XDP_ADJUST_TAIL_GROW_MULTI_BUFF", .test_func = testapp_adjust_tail_grow_mb},
287285
{.name = "TX_QUEUE_CONSUMER", .test_func = testapp_tx_queue_consumer},
288286
};
289287

288+
static const struct test_spec flaky_tests[] = {
289+
{.name = "XDP_ADJUST_TAIL_GROW", .test_func = testapp_adjust_tail_grow},
290+
{.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
291+
};
292+
293+
290294
#endif /* TEST_XSK_H_ */

tools/testing/selftests/bpf/xskxceiver.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,13 @@ static void print_tests(void)
311311
printf("Tests:\n");
312312
for (i = 0; i < ARRAY_SIZE(tests); i++)
313313
printf("%u: %s\n", i, tests[i].name);
314+
for (i = ARRAY_SIZE(tests); i < ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests); i++)
315+
printf("%u: %s\n", i, flaky_tests[i - ARRAY_SIZE(tests)].name);
314316
}
315317

316318
int main(int argc, char **argv)
317319
{
320+
const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests);
318321
struct pkt_stream *rx_pkt_stream_default;
319322
struct pkt_stream *tx_pkt_stream_default;
320323
struct ifobject *ifobj_tx, *ifobj_rx;
@@ -342,7 +345,7 @@ int main(int argc, char **argv)
342345
print_tests();
343346
ksft_exit_xpass();
344347
}
345-
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= ARRAY_SIZE(tests)) {
348+
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= total_tests) {
346349
ksft_print_msg("Error: test %u does not exist.\n", opt_run_test);
347350
ksft_exit_xfail();
348351
}
@@ -382,7 +385,7 @@ int main(int argc, char **argv)
382385
test.rx_pkt_stream_default = rx_pkt_stream_default;
383386

384387
if (opt_run_test == RUN_ALL_TESTS)
385-
nb_tests = ARRAY_SIZE(tests);
388+
nb_tests = total_tests;
386389
else
387390
nb_tests = 1;
388391
if (opt_mode == TEST_MODE_ALL) {
@@ -404,11 +407,15 @@ int main(int argc, char **argv)
404407
if (opt_mode != TEST_MODE_ALL && i != opt_mode)
405408
continue;
406409

407-
for (j = 0; j < ARRAY_SIZE(tests); j++) {
410+
for (j = 0; j < total_tests; j++) {
408411
if (opt_run_test != RUN_ALL_TESTS && j != opt_run_test)
409412
continue;
410413

411-
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
414+
if (j < ARRAY_SIZE(tests))
415+
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
416+
else
417+
test_init(&test, ifobj_tx, ifobj_rx, i,
418+
&flaky_tests[j - ARRAY_SIZE(tests)]);
412419
run_pkt_test(&test);
413420
usleep(USLEEP_MAX);
414421

0 commit comments

Comments
 (0)