selftests: pmtu.sh: Kill nettest processes launched in subshell.
authorGuillaume Nault <gnault@redhat.com>
Tue, 8 Mar 2022 22:15:03 +0000 (23:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Mar 2022 13:23:39 +0000 (14:23 +0100)
commitc614aad2ee9ef37eba8efe0a54ba5c12f8807129
treeec286388de0b3493ebcaa7d9eec3ca111240262e
parentd4dfc94c40529afb86a8218702d97120b3aa73b3
selftests: pmtu.sh: Kill nettest processes launched in subshell.

[ Upstream commit 94a4a4fe4c696413932eed8bdec46574de9576b8 ]

When using "run_cmd <command> &", then "$!" refers to the PID of the
subshell used to run <command>, not the command itself. Therefore
nettest_pids actually doesn't contain the list of the nettest commands
running in the background. So cleanup() can't kill them and the nettest
processes run until completion (fortunately they have a 5s timeout).

Fix this by defining a new command for running processes in the
background, for which "$!" really refers to the PID of the command run.

Also, double quote variables on the modified lines, to avoid shellcheck
warnings.

Fixes: ece1278a9b81 ("selftests: net: add ESP-in-UDP PMTU test")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/net/pmtu.sh