summaryrefslogtreecommitdiffstats
path: root/tools/testing
diff options
context:
space:
mode:
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>2022-09-01 13:48:12 +0200
committerDaniel Borkmann <daniel@iogearbox.net>2022-09-02 15:38:03 +0200
commitc29fe883defcbc6cd16176787a2084b8e05dabf0 (patch)
treeb28c953ba80aee644f663ada90864b76c39392b7 /tools/testing
parenta693ff3ed5610a07b1b0dd831d10f516e13cf6c6 (diff)
downloadlinux-c29fe883defcbc6cd16176787a2084b8e05dabf0.tar.bz2
selftests/xsk: Make sure single threaded test terminates
For single threaded poll tests call pthread_kill() from main thread so that we are sure worker thread has finished its job and it is possible to proceed with next test types from test suite. It was observed that on some platforms it takes a bit longer for worker thread to exit and next test case sees device as busy in this case. Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/bpf/20220901114813.16275-6-maciej.fijalkowski@intel.com
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/bpf/xskxceiver.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index b54b844cae89..74b21ddf5a98 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1345,6 +1345,11 @@ static void testapp_clean_xsk_umem(struct ifobject *ifobj)
munmap(ifobj->umem->buffer, umem_sz);
}
+static void handler(int signum)
+{
+ pthread_exit(NULL);
+}
+
static int testapp_validate_traffic_single_thread(struct test_spec *test, struct ifobject *ifobj,
enum test_type type)
{
@@ -1362,6 +1367,7 @@ static int testapp_validate_traffic_single_thread(struct test_spec *test, struct
test->ifobj_rx->shared_umem = false;
test->ifobj_tx->shared_umem = false;
+ signal(SIGUSR1, handler);
/* Spawn thread */
pthread_create(&t0, NULL, ifobj->func_ptr, test);
@@ -1371,6 +1377,7 @@ static int testapp_validate_traffic_single_thread(struct test_spec *test, struct
if (pthread_barrier_destroy(&barr))
exit_with_error(errno);
+ pthread_kill(t0, SIGUSR1);
pthread_join(t0, NULL);
if (test->total_steps == test->current_step || test->fail) {