Skip to content

Commit a6150d3

Browse files
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) <bastien.curutchet@bootlin.com>
1 parent c1e506b commit a6150d3

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

tools/testing/selftests/bpf/test_xsk.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,6 @@ static const struct test_spec tests[] = {
270270
{.name = "XDP_PROG_CLEANUP", .test_func = testapp_xdp_prog_cleanup},
271271
{.name = "XDP_DROP_HALF", .test_func = testapp_xdp_drop},
272272
{.name = "XDP_SHARED_UMEM", .test_func = testapp_xdp_shared_umem},
273-
{.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata},
274-
{.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb},
275-
{.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
276273
{.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
277274
.test_func = testapp_send_receive_unaligned_mb},
278275
{.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb},
@@ -282,9 +279,16 @@ static const struct test_spec tests[] = {
282279
{.name = "HW_SW_MAX_RING_SIZE", .test_func = testapp_hw_sw_max_ring_size},
283280
{.name = "XDP_ADJUST_TAIL_SHRINK", .test_func = testapp_adjust_tail_shrink},
284281
{.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},
286282
{.name = "XDP_ADJUST_TAIL_GROW_MULTI_BUFF", .test_func = testapp_adjust_tail_grow_mb},
287283
{.name = "TX_QUEUE_CONSUMER", .test_func = testapp_tx_queue_consumer},
288284
};
289285

286+
static const struct test_spec flaky_tests[] = {
287+
{.name = "XDP_ADJUST_TAIL_GROW", .test_func = testapp_adjust_tail_grow},
288+
{.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata},
289+
{.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb},
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: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,14 @@ 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+
printf("== Flaky tests:\n");
315+
for (i = ARRAY_SIZE(tests); i < ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests); i++)
316+
printf("%u: %s\n", i, flaky_tests[i - ARRAY_SIZE(tests)].name);
314317
}
315318

316319
int main(int argc, char **argv)
317320
{
321+
const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests);
318322
struct pkt_stream *rx_pkt_stream_default;
319323
struct pkt_stream *tx_pkt_stream_default;
320324
struct ifobject *ifobj_tx, *ifobj_rx;
@@ -342,7 +346,7 @@ int main(int argc, char **argv)
342346
print_tests();
343347
ksft_exit_xpass();
344348
}
345-
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= ARRAY_SIZE(tests)) {
349+
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= total_tests) {
346350
ksft_print_msg("Error: test %u does not exist.\n", opt_run_test);
347351
ksft_exit_xfail();
348352
}
@@ -382,7 +386,7 @@ int main(int argc, char **argv)
382386
test.rx_pkt_stream_default = rx_pkt_stream_default;
383387

384388
if (opt_run_test == RUN_ALL_TESTS)
385-
nb_tests = ARRAY_SIZE(tests);
389+
nb_tests = total_tests;
386390
else
387391
nb_tests = 1;
388392
if (opt_mode == TEST_MODE_ALL) {
@@ -404,11 +408,15 @@ int main(int argc, char **argv)
404408
if (opt_mode != TEST_MODE_ALL && i != opt_mode)
405409
continue;
406410

407-
for (j = 0; j < ARRAY_SIZE(tests); j++) {
411+
for (j = 0; j < total_tests; j++) {
408412
if (opt_run_test != RUN_ALL_TESTS && j != opt_run_test)
409413
continue;
410414

411-
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
415+
if (j < ARRAY_SIZE(tests))
416+
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
417+
else
418+
test_init(&test, ifobj_tx, ifobj_rx, i,
419+
&flaky_tests[j - ARRAY_SIZE(tests)]);
412420
run_pkt_test(&test);
413421
usleep(USLEEP_MAX);
414422

0 commit comments

Comments
 (0)