Skip to content

Commit 3b054b7

Browse files
Jiri Bencborkmann
authored andcommitted
selftests, bpf: Fix test_tc_tunnel hanging
When run_kselftests.sh is run, it hangs after test_tc_tunnel.sh. The reason is test_tc_tunnel.sh ensures the server ('nc -l') is run all the time, starting it again every time it is expected to terminate. The exception is the final client_connect: the server is not started anymore, which ensures no process is kept running after the test is finished. For a sit test, though, the script is terminated prematurely without the final client_connect and the 'nc' process keeps running. This in turn causes the run_one function in kselftest/runner.sh to hang forever, waiting for the runaway process to finish. Ensure a remaining server is terminated on cleanup. Fixes: f6ad6ac ("selftests/bpf: expand test_tc_tunnel with SIT encap") Signed-off-by: Jiri Benc <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Link: https://lore.kernel.org/bpf/60919291657a9ee89c708d8aababc28ebe1420be.1573821780.git.jbenc@redhat.com
1 parent 56bf877 commit 3b054b7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/testing/selftests/bpf/test_tc_tunnel.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ cleanup() {
6262
if [[ -f "${infile}" ]]; then
6363
rm "${infile}"
6464
fi
65+
66+
if [[ -n $server_pid ]]; then
67+
kill $server_pid 2> /dev/null
68+
fi
6569
}
6670

6771
server_listen() {
@@ -77,6 +81,7 @@ client_connect() {
7781

7882
verify_data() {
7983
wait "${server_pid}"
84+
server_pid=
8085
# sha1sum returns two fields [sha1] [filepath]
8186
# convert to bash array and access first elem
8287
insum=($(sha1sum ${infile}))

0 commit comments

Comments
 (0)