]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: net: fix passive TFO test to fail if child processes failed
authorYohei Kojima <yk@y-koj.net>
Tue, 13 Jan 2026 14:11:54 +0000 (23:11 +0900)
committerJakub Kicinski <kuba@kernel.org>
Sun, 18 Jan 2026 02:01:26 +0000 (18:01 -0800)
Improve the passive TFO test to report failure if the server or the
client timed out or exited with non-zero status.

Before this commit, TFO test didn't fail even if exit(EXIT_FAILURE) is
added to the first line of the run_server() and run_client() functions.

Signed-off-by: Yohei Kojima <yk@y-koj.net>
Link: https://patch.msgid.link/214d399caec2e5de7738ced5736829915d507e4e.1768312014.git.yk@y-koj.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/tfo_passive.sh

index a4550511830a9b1b464dacca959a4026f0775177..f116f888b794bec0a54dd7f3a8e51130d3460f3f 100755 (executable)
@@ -85,12 +85,15 @@ timeout -k 1s 30s ip netns exec nssv ./tfo        \
                                -s                \
                                -p ${SERVER_PORT} \
                                -o ${out_file}&
+server_pid="$!"
 
 wait_local_port_listen nssv ${SERVER_PORT} tcp
 
 ip netns exec nscl ./tfo -c -h ${SERVER_IP} -p ${SERVER_PORT}
+client_exit_status="$?"
 
-wait
+wait "$server_pid"
+server_exit_status="$?"
 
 res=$(cat $out_file)
 rm $out_file
@@ -101,6 +104,14 @@ if [ "$res" = "0" ]; then
        exit 1
 fi
 
+if [ "$client_exit_status" -ne 0 ] || [ "$server_exit_status" -ne 0 ]; then
+       # Note: timeout(1) exits with 124 if it timed out
+       echo "client exited with ${client_exit_status}"
+       echo "server exited with ${server_exit_status}"
+       cleanup_ns
+       exit 1
+fi
+
 echo "$NSIM_SV_FD:$NSIM_SV_IFIDX" > $NSIM_DEV_SYS_UNLINK
 
 echo $NSIM_CL_ID > $NSIM_DEV_SYS_DEL