Skip to content

Commit 844b13a

Browse files
bastien-curutchetAlexei Starovoitov
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. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 5b2a757 commit 844b13a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

tools/testing/selftests/bpf/test_xsk.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,12 +1772,12 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
17721772
err = test_spec_set_mtu(test, test->mtu);
17731773
if (err) {
17741774
ksft_print_msg("Error, could not set mtu.\n");
1775-
exit_with_error(err);
1775+
return TEST_FAILURE;
17761776
}
17771777

17781778
if (ifobj2) {
17791779
if (pthread_barrier_init(&barr, NULL, 2))
1780-
exit_with_error(errno);
1780+
return TEST_FAILURE;
17811781
pkt_stream_reset(ifobj2->xsk->pkt_stream);
17821782
}
17831783

@@ -1791,8 +1791,12 @@ static int __testapp_validate_traffic(struct test_spec *test, struct ifobject *i
17911791

17921792
if (ifobj2) {
17931793
pthread_barrier_wait(&barr);
1794-
if (pthread_barrier_destroy(&barr))
1795-
exit_with_error(errno);
1794+
if (pthread_barrier_destroy(&barr)) {
1795+
pthread_kill(t0, SIGUSR1);
1796+
clean_sockets(test, ifobj1);
1797+
clean_umem(test, ifobj1, NULL);
1798+
return TEST_FAILURE;
1799+
}
17961800

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

0 commit comments

Comments
 (0)