summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net
diff options
context:
space:
mode:
authorRoxana Nicolescu <roxana.nicolescu@canonical.com>2023-02-20 12:04:00 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-11 16:31:39 +0100
commit488ec80854897784ec4a61c05714696b2087e285 (patch)
treea7ea06266b5481db3af3566eb49305594c9c18f9 /tools/testing/selftests/net
parentb7dd1b75b32a59ef3d6297af75805bdb4b09beee (diff)
downloadlinux-stable-488ec80854897784ec4a61c05714696b2087e285.tar.gz
linux-stable-488ec80854897784ec4a61c05714696b2087e285.tar.bz2
linux-stable-488ec80854897784ec4a61c05714696b2087e285.zip
selftest: fib_tests: Always cleanup before exit
[ Upstream commit b60417a9f2b890a8094477b2204d4f73c535725e ] 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: 1056691b2680 ("selftests: fib_tests: Make test results more verbose") Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com> Link: https://lore.kernel.org/r/20230220110400.26737-2-roxana.nicolescu@canonical.com Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net')
-rwxr-xr-xtools/testing/selftests/net/fib_tests.sh2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh
index a5ba149761bf..f34e14e34d0d 100755
--- a/tools/testing/selftests/net/fib_tests.sh
+++ b/tools/testing/selftests/net/fib_tests.sh
@@ -1379,6 +1379,8 @@ EOF
################################################################################
# main
+trap cleanup EXIT
+
while getopts :t:pPhv o
do
case $o in