Skip to content

Commit aa3a3b3

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 4d898f4 commit aa3a3b3

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
@@ -326,10 +326,13 @@ static void print_tests(void)
326326
printf("Tests:\n");
327327
for (i = 0; i < ARRAY_SIZE(tests); i++)
328328
printf("%u: %s\n", i, tests[i].name);
329+
for (i = ARRAY_SIZE(tests); i < ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests); i++)
330+
printf("%u: %s\n", i, flaky_tests[i - ARRAY_SIZE(tests)].name);
329331
}
330332

331333
int main(int argc, char **argv)
332334
{
335+
const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests);
333336
struct pkt_stream *rx_pkt_stream_default;
334337
struct pkt_stream *tx_pkt_stream_default;
335338
struct ifobject *ifobj_tx, *ifobj_rx;
@@ -357,7 +360,7 @@ int main(int argc, char **argv)
357360
print_tests();
358361
ksft_exit_xpass();
359362
}
360-
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= ARRAY_SIZE(tests)) {
363+
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= total_tests) {
361364
ksft_print_msg("Error: test %u does not exist.\n", opt_run_test);
362365
ksft_exit_xfail();
363366
}
@@ -397,7 +400,7 @@ int main(int argc, char **argv)
397400
test.rx_pkt_stream_default = rx_pkt_stream_default;
398401

399402
if (opt_run_test == RUN_ALL_TESTS)
400-
nb_tests = ARRAY_SIZE(tests);
403+
nb_tests = total_tests;
401404
else
402405
nb_tests = 1;
403406
if (opt_mode == TEST_MODE_ALL) {
@@ -419,11 +422,15 @@ int main(int argc, char **argv)
419422
if (opt_mode != TEST_MODE_ALL && i != opt_mode)
420423
continue;
421424

422-
for (j = 0; j < ARRAY_SIZE(tests); j++) {
425+
for (j = 0; j < total_tests; j++) {
423426
if (opt_run_test != RUN_ALL_TESTS && j != opt_run_test)
424427
continue;
425428

426-
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
429+
if (j < ARRAY_SIZE(tests))
430+
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
431+
else
432+
test_init(&test, ifobj_tx, ifobj_rx, i,
433+
&flaky_tests[j - ARRAY_SIZE(tests)]);
427434
run_pkt_test(&test);
428435
usleep(USLEEP_MAX);
429436

0 commit comments

Comments
 (0)