Merge branch 'selftests-pmtu-sh-fix-cleanup-of-processes-launched-in-subshell'
Guillaume Nault says: ==================== selftests: pmtu.sh: Fix cleanup of processes launched in subshell. Depending on the options used, pmtu.sh may launch tcpdump and nettest processes in the background. However it fails to clean them up after the tests complete. Patch 1 allows the cleanup() function to read the list of PIDs launched by the tests. Patch 2 fixes the way the nettest PIDs are retrieved. ==================== Link: https://lore.kernel.org/r/cover.1646776561.git.gnault@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
5f14747605
@ -374,6 +374,16 @@ run_cmd() {
|
||||
return $rc
|
||||
}
|
||||
|
||||
run_cmd_bg() {
|
||||
cmd="$*"
|
||||
|
||||
if [ "$VERBOSE" = "1" ]; then
|
||||
printf " COMMAND: %s &\n" "${cmd}"
|
||||
fi
|
||||
|
||||
$cmd 2>&1 &
|
||||
}
|
||||
|
||||
# Find the auto-generated name for this namespace
|
||||
nsname() {
|
||||
eval echo \$NS_$1
|
||||
@ -670,10 +680,10 @@ setup_nettest_xfrm() {
|
||||
[ ${1} -eq 6 ] && proto="-6" || proto=""
|
||||
port=${2}
|
||||
|
||||
run_cmd ${ns_a} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
|
||||
run_cmd_bg "${ns_a}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
|
||||
nettest_pids="${nettest_pids} $!"
|
||||
|
||||
run_cmd ${ns_b} nettest ${proto} -q -D -s -x -p ${port} -t 5 &
|
||||
run_cmd_bg "${ns_b}" nettest "${proto}" -q -D -s -x -p "${port}" -t 5
|
||||
nettest_pids="${nettest_pids} $!"
|
||||
}
|
||||
|
||||
@ -865,7 +875,6 @@ setup_ovs_bridge() {
|
||||
setup() {
|
||||
[ "$(id -u)" -ne 0 ] && echo " need to run as root" && return $ksft_skip
|
||||
|
||||
cleanup
|
||||
for arg do
|
||||
eval setup_${arg} || { echo " ${arg} not supported"; return 1; }
|
||||
done
|
||||
@ -876,7 +885,7 @@ trace() {
|
||||
|
||||
for arg do
|
||||
[ "${ns_cmd}" = "" ] && ns_cmd="${arg}" && continue
|
||||
${ns_cmd} tcpdump -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
||||
${ns_cmd} tcpdump --immediate-mode -s 0 -i "${arg}" -w "${name}_${arg}.pcap" 2> /dev/null &
|
||||
tcpdump_pids="${tcpdump_pids} $!"
|
||||
ns_cmd=
|
||||
done
|
||||
@ -1836,6 +1845,10 @@ run_test() {
|
||||
|
||||
unset IFS
|
||||
|
||||
# Since cleanup() relies on variables modified by this subshell, it
|
||||
# has to run in this context.
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ "$VERBOSE" = "1" ]; then
|
||||
printf "\n##########################################################################\n\n"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user