Skip to content

Commit 8211ebc

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. Reviewed-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Bastien Curutchet (eBPF Foundation) <[email protected]>
1 parent 9b1d9e0 commit 8211ebc

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
@@ -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,11 @@ 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+
clean_sockets(test, ifobj1);
1796+
clean_umem(test, ifobj1, NULL);
1797+
return TEST_FAILURE;
1798+
}
17961799

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

0 commit comments

Comments
 (0)