Skip to content

Commit a6b3f03

Browse files
bastien-curutchetKernel Patches Daemon
authored andcommitted
selftests/bpf: test_xsk: Don't exit immediately if validate_traffic fails
__testapp_validate_traffic() calls exit_with_error() on failures. This exits the program immediately. It prevents the following tests from running and isn't compliant with the CI. Return TEST_FAILURE instead of calling exit_with_error(). Release the resource of the 1st thread if a failure happens between its creation and the creation of the second thread. Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 90dffbc commit a6b3f03

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/testing/selftests/bpf/test_xsk.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,12 +1782,12 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
17821782
err = test_spec_set_mtu(test, test->mtu);
17831783
if (err) {
17841784
ksft_print_msg("Error, could not set mtu.\n");
1785-
exit_with_error(err);
1785+
return TEST_FAILURE;
17861786
}
17871787

17881788
if (ifobj2) {
17891789
if (pthread_barrier_init(&barr, NULL, 2))
1790-
exit_with_error(errno);
1790+
return TEST_FAILURE;
17911791
pkt_stream_reset(ifobj2->xsk->pkt_stream);
17921792
}
17931793

@@ -1801,8 +1801,11 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
18011801

18021802
if (ifobj2) {
18031803
pthread_barrier_wait(&barr);
1804-
if (pthread_barrier_destroy(&barr))
1805-
exit_with_error(errno);
1804+
if (pthread_barrier_destroy(&barr)) {
1805+
clean_sockets(test, ifobj1);
1806+
clean_umem(test, ifobj1, NULL);
1807+
return TEST_FAILURE;
1808+
}
18061809

18071810
/*Spawn TX thread */
18081811
pthread_create(&t1, NULL, ifobj2->func_ptr, test);

0 commit comments

Comments
 (0)