Skip to content

Commit 7e0620b

Browse files
matttbekuba-moo
authored andcommitted
selftests: net: lib: ignore possible errors
No need to disable errexit temporary, simply ignore the only possible and not handled error. Reviewed-by: Geliang Tang <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://lore.kernel.org/r/20240607-upstream-net-next-20240607-selftests-mptcp-net-lib-v1-1-e36986faac94@kernel.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bfc6507 commit 7e0620b

File tree

1 file changed

+1
-9
lines changed
  • tools/testing/selftests/net

1 file changed

+1
-9
lines changed

tools/testing/selftests/net/lib.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,25 +128,17 @@ slowwait_for_counter()
128128
cleanup_ns()
129129
{
130130
local ns=""
131-
local errexit=0
132131
local ret=0
133132

134-
# disable errexit temporary
135-
if [[ $- =~ "e" ]]; then
136-
errexit=1
137-
set +e
138-
fi
139-
140133
for ns in "$@"; do
141134
[ -z "${ns}" ] && continue
142-
ip netns delete "${ns}" &> /dev/null
135+
ip netns delete "${ns}" &> /dev/null || true
143136
if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
144137
echo "Warn: Failed to remove namespace $ns"
145138
ret=1
146139
fi
147140
done
148141

149-
[ $errexit -eq 1 ] && set -e
150142
return $ret
151143
}
152144

0 commit comments

Comments
 (0)