From 4dff376c26855f2a2ae63e713e5db3e76b999b39 Mon Sep 17 00:00:00 2001 From: Roxana Nicolescu Date: Wed, 12 Apr 2023 07:06:00 +0200 Subject: [PATCH] selftest: fib_tests: Always cleanup before exit BugLink: https://bugs.launchpad.net/bugs/2015956 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 Link: https://lore.kernel.org/r/20230220110400.26737-2-roxana.nicolescu@canonical.com Signed-off-by: Paolo Abeni (cherry picked from commit b60417a9f2b890a8094477b2204d4f73c535725e) Signed-off-by: Po-Hsu Lin Acked-by: Roxana Nicolescu Acked-by: Andrei Gherzan Signed-off-by: Stefan Bader --- tools/testing/selftests/net/fib_tests.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/net/fib_tests.sh b/tools/testing/selftests/net/fib_tests.sh index 6986086035d6..24d67fa66d03 100755 --- a/tools/testing/selftests/net/fib_tests.sh +++ b/tools/testing/selftests/net/fib_tests.sh @@ -1662,6 +1662,8 @@ EOF ################################################################################ # main +trap cleanup EXIT + while getopts :t:pPhv o do case $o in