Skip to content

Commit

Permalink
selftests: net: lib: ignore possible errors
Browse files Browse the repository at this point in the history
No need to disable errexit temporary, simply ignore the only possible
and not handled error.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
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 <kuba@kernel.org>
  • Loading branch information
Matthieu Baerts (NGI0) authored and Jakub Kicinski committed Jun 12, 2024
1 parent bfc6507 commit 7e0620b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions tools/testing/selftests/net/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,25 +128,17 @@ slowwait_for_counter()
cleanup_ns()
{
local ns=""
local errexit=0
local ret=0

# disable errexit temporary
if [[ $- =~ "e" ]]; then
errexit=1
set +e
fi

for ns in "$@"; do
[ -z "${ns}" ] && continue
ip netns delete "${ns}" &> /dev/null
ip netns delete "${ns}" &> /dev/null || true
if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then
echo "Warn: Failed to remove namespace $ns"
ret=1
fi
done

[ $errexit -eq 1 ] && set -e
return $ret
}

Expand Down

0 comments on commit 7e0620b

Please sign in to comment.