Skip to content

Commit

Permalink
selftest: fib_tests: Always cleanup before exit
Browse files Browse the repository at this point in the history
[ Upstream commit b60417a ]

Usage of `set -e` before executing a command causes immediate exit
on failure, without cleanup up the resources allocated at setup.
This can affect the next tests that use the same resources,
leading to a chain of failures.

A simple fix is to always call cleanup function when the script exists.
This approach is already used by other existing tests.

Fixes: 1056691 ("selftests: fib_tests: Make test results more verbose")
Signed-off-by: Roxana Nicolescu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
roxanan1996 authored and Sasha Levin committed Mar 5, 2023
1 parent 5cf2c13 commit 8cf3efe
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/net/fib_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1773,6 +1773,8 @@ EOF
################################################################################
# main

trap cleanup EXIT

while getopts :t:pPhv o
do
case $o in
Expand Down

0 comments on commit 8cf3efe

Please sign in to comment.