mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
Merge branch 'selftests-net-lib-small-fixes'
Matthieu Baerts says: ==================== selftests: net: lib: small fixes While looking at using 'lib.sh' for the MPTCP selftests [1], we found some small issues with 'lib.sh'. Here they are: - Patch 1: fix 'errexit' (set -e) support with busywait. 'errexit' is supported in some functions, not all. A fix for v6.8+. - Patch 2: avoid confusing error messages linked to the cleaning part when the netns setup fails. A fix for v6.8+. - Patch 3: set a variable as local to avoid accidentally changing the value of a another one with the same name on the caller side. A fix for v6.10-rc1+. Link: https://lore.kernel.org/mptcp/5f4615c3-0621-43c5-ad25-55747a4350ce@kernel.org/T/ [1] ==================== Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-0-b3afadd368c9@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
27bc865408
@ -15,7 +15,7 @@ ksft_xfail=2
|
||||
ksft_skip=4
|
||||
|
||||
# namespace list created by setup_ns
|
||||
NS_LIST=""
|
||||
NS_LIST=()
|
||||
|
||||
##############################################################################
|
||||
# Helpers
|
||||
@ -27,6 +27,7 @@ __ksft_status_merge()
|
||||
local -A weights
|
||||
local weight=0
|
||||
|
||||
local i
|
||||
for i in "$@"; do
|
||||
weights[$i]=$((weight++))
|
||||
done
|
||||
@ -67,9 +68,7 @@ loopy_wait()
|
||||
while true
|
||||
do
|
||||
local out
|
||||
out=$("$@")
|
||||
local ret=$?
|
||||
if ((!ret)); then
|
||||
if out=$("$@"); then
|
||||
echo -n "$out"
|
||||
return 0
|
||||
fi
|
||||
@ -139,6 +138,7 @@ cleanup_ns()
|
||||
fi
|
||||
|
||||
for ns in "$@"; do
|
||||
[ -z "${ns}" ] && continue
|
||||
ip netns delete "${ns}" &> /dev/null
|
||||
if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
|
||||
echo "Warn: Failed to remove namespace $ns"
|
||||
@ -152,7 +152,7 @@ cleanup_ns()
|
||||
|
||||
cleanup_all_ns()
|
||||
{
|
||||
cleanup_ns $NS_LIST
|
||||
cleanup_ns "${NS_LIST[@]}"
|
||||
}
|
||||
|
||||
# setup netns with given names as prefix. e.g
|
||||
@ -161,7 +161,7 @@ setup_ns()
|
||||
{
|
||||
local ns=""
|
||||
local ns_name=""
|
||||
local ns_list=""
|
||||
local ns_list=()
|
||||
local ns_exist=
|
||||
for ns_name in "$@"; do
|
||||
# Some test may setup/remove same netns multi times
|
||||
@ -177,13 +177,13 @@ setup_ns()
|
||||
|
||||
if ! ip netns add "$ns"; then
|
||||
echo "Failed to create namespace $ns_name"
|
||||
cleanup_ns "$ns_list"
|
||||
cleanup_ns "${ns_list[@]}"
|
||||
return $ksft_skip
|
||||
fi
|
||||
ip -n "$ns" link set lo up
|
||||
! $ns_exist && ns_list="$ns_list $ns"
|
||||
! $ns_exist && ns_list+=("$ns")
|
||||
done
|
||||
NS_LIST="$NS_LIST $ns_list"
|
||||
NS_LIST+=("${ns_list[@]}")
|
||||
}
|
||||
|
||||
tc_rule_stats_get()
|
||||
|
Loading…
Reference in New Issue
Block a user