Skip to content

Commit 4d78bb9

Browse files
selftests/bpf: test_xsk: Isolate flaky tests
Some tests are flaky (especially on s390). So they don't fit in the CI. Remove flaky tests from the tests table so they won't be run by the CI in upcoming patch. Create a flaky_tests table to hold them. Use the flaky table in xskxceiver.c so the tests remain available for HW in test_xsk.sh. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 80180c2 commit 4d78bb9

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
@@ -266,7 +266,6 @@ static const struct test_spec tests[] = {
266266
{.name = "UNALIGNED_INV_DESC_4001_FRAME_SIZE",
267267
.test_func = testapp_unaligned_inv_desc_4001_frame},
268268
{.name = "UMEM_HEADROOM", .test_func = testapp_headroom},
269-
{.name = "TEARDOWN", .test_func = testapp_teardown},
270269
{.name = "BIDIRECTIONAL", .test_func = testapp_bidirectional},
271270
{.name = "STAT_RX_DROPPED", .test_func = testapp_stats_rx_dropped},
272271
{.name = "STAT_TX_INVALID", .test_func = testapp_stats_tx_invalid_descs},
@@ -277,9 +276,6 @@ static const struct test_spec tests[] = {
277276
{.name = "XDP_SHARED_UMEM", .test_func = testapp_xdp_shared_umem},
278277
{.name = "XDP_METADATA_COPY", .test_func = testapp_xdp_metadata},
279278
{.name = "XDP_METADATA_COPY_MULTI_BUFF", .test_func = testapp_xdp_metadata_mb},
280-
{.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
281-
{.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
282-
.test_func = testapp_send_receive_unaligned_mb},
283279
{.name = "ALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_aligned_inv_desc_mb},
284280
{.name = "UNALIGNED_INV_DESC_MULTI_BUFF", .test_func = testapp_unaligned_inv_desc_mb},
285281
{.name = "TOO_MANY_FRAGS", .test_func = testapp_too_many_frags},
@@ -292,4 +288,12 @@ static const struct test_spec tests[] = {
292288
{.name = "TX_QUEUE_CONSUMER", .test_func = testapp_tx_queue_consumer},
293289
};
294290

291+
static const struct test_spec flaky_tests[] = {
292+
{.name = "TEARDOWN", .test_func = testapp_teardown},
293+
{.name = "SEND_RECEIVE_9K_PACKETS", .test_func = testapp_send_receive_mb},
294+
{.name = "SEND_RECEIVE_UNALIGNED_9K_PACKETS",
295+
.test_func = testapp_send_receive_unaligned_mb},
296+
};
297+
298+
295299
#endif /* TEST_XSK_H_ */

tools/testing/selftests/bpf/xskxceiver.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,14 @@ static void print_tests(void)
350350
printf("Tests:\n");
351351
for (i = 0; i < ARRAY_SIZE(tests); i++)
352352
printf("%u: %s\n", i, tests[i].name);
353+
printf("== Flaky tests:\n");
354+
for (i = ARRAY_SIZE(tests); i < ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests); i++)
355+
printf("%u: %s\n", i, flaky_tests[i - ARRAY_SIZE(tests)].name);
353356
}
354357

355358
int main(int argc, char **argv)
356359
{
360+
const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(flaky_tests);
357361
struct pkt_stream *rx_pkt_stream_default;
358362
struct pkt_stream *tx_pkt_stream_default;
359363
struct ifobject *ifobj_tx, *ifobj_rx;
@@ -381,7 +385,7 @@ int main(int argc, char **argv)
381385
print_tests();
382386
ksft_exit_xpass();
383387
}
384-
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= ARRAY_SIZE(tests)) {
388+
if (opt_run_test != RUN_ALL_TESTS && opt_run_test >= total_tests) {
385389
ksft_print_msg("Error: test %u does not exist.\n", opt_run_test);
386390
ksft_exit_xfail();
387391
}
@@ -421,7 +425,7 @@ int main(int argc, char **argv)
421425
test.rx_pkt_stream_default = rx_pkt_stream_default;
422426

423427
if (opt_run_test == RUN_ALL_TESTS)
424-
nb_tests = ARRAY_SIZE(tests);
428+
nb_tests = total_tests;
425429
else
426430
nb_tests = 1;
427431
if (opt_mode == TEST_MODE_ALL) {
@@ -443,11 +447,15 @@ int main(int argc, char **argv)
443447
if (opt_mode != TEST_MODE_ALL && i != opt_mode)
444448
continue;
445449

446-
for (j = 0; j < ARRAY_SIZE(tests); j++) {
450+
for (j = 0; j < total_tests; j++) {
447451
if (opt_run_test != RUN_ALL_TESTS && j != opt_run_test)
448452
continue;
449453

450-
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
454+
if (j < ARRAY_SIZE(tests))
455+
test_init(&test, ifobj_tx, ifobj_rx, i, &tests[j]);
456+
else
457+
test_init(&test, ifobj_tx, ifobj_rx, i,
458+
&flaky_tests[j - ARRAY_SIZE(tests)]);
451459
run_pkt_test(&test);
452460
usleep(USLEEP_MAX);
453461

0 commit comments

Comments
 (0)