selftests/bpf: Drop python client/server in favor of threads
authorAlexander Duyck <alexanderduyck@fb.com>
Tue, 3 Nov 2020 21:34:56 +0000 (13:34 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 4 Nov 2020 01:52:37 +0000 (17:52 -0800)
commit247f0ec361b7e0c5c67db8222873182fb8be5146
treecb2a0d6065401620187bbda2edea63b65f89af81
parentaaf376bddf68d0afe5f4b5f25fc555da358e2287
selftests/bpf: Drop python client/server in favor of threads

Drop the tcp_client/server.py files in favor of using a client and server
thread within the test case. Specifically we spawn a new thread to play the
role of the server, and the main testing thread plays the role of client.

Add logic to the end of the run_test function to guarantee that the sockets
are closed when we begin verifying results.

Doing this we are able to reduce overhead since we don't have two python
workers possibly floating around. In addition we don't have to worry about
synchronization issues and as such the retry loop waiting for the threads
to close the sockets can be dropped as we will have already closed the
sockets in the local executable and synchronized the server thread.

Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/160443929638.1086697.2430242340980315521.stgit@localhost.localdomain
tools/testing/selftests/bpf/prog_tests/tcpbpf_user.c
tools/testing/selftests/bpf/tcp_client.py [deleted file]
tools/testing/selftests/bpf/tcp_server.py [deleted file]