From: Petr Machata Date: Thu, 17 Oct 2024 09:45:45 +0000 (+0200) Subject: selftests: forwarding: lib: Allow passing PID to stop_traffic() X-Git-Tag: v6.13-rc1~135^2~255^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e07d5dbfbd9b0441ae4ec07a2a72738121356e2;p=thirdparty%2Fkernel%2Flinux.git selftests: forwarding: lib: Allow passing PID to stop_traffic() Now that it is possible to schedule a deferral of stop_traffic() right after the traffic is started, we do not have to rely on the %% magic to kill the background process that was started last. Instead we can just give the PID explicitly. This makes it possible to start other background processes after the traffic is started without confusing the cleanup. Signed-off-by: Petr Machata Signed-off-by: Paolo Abeni --- diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 76e6d7698caff..89c25f72b10c5 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -1768,8 +1768,10 @@ start_tcp_traffic() stop_traffic() { + local pid=${1-%%}; shift + # Suppress noise from killing mausezahn. - { kill %% && wait %%; } 2>/dev/null + { kill $pid && wait $pid; } 2>/dev/null } declare -A cappid