]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: forwarding: Add a fallback cleanup()
authorPetr Machata <petrm@nvidia.com>
Thu, 17 Oct 2024 09:45:44 +0000 (11:45 +0200)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 22 Oct 2024 11:33:47 +0000 (13:33 +0200)
Consistent use of defers obviates the need for a separate test-specific
cleanup function -- everything is just taken care of in defers. So in this
patch, introduce a cleanup() helper in the forwarding lib.sh, which calls
just pre_cleanup() and defer_scopes_cleanup(). Selftests are obviously
still free to override the function.

Since pre_cleanup() is too entangled with forwarding-specific minutia, the
function cannot currently be in net/lib.sh.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/testing/selftests/net/forwarding/lib.sh

index d24b6af7ebfa44a7d544daff4f239ba805e25ede..76e6d7698cafffcac690c9c946f088cfaacdd49e 100644 (file)
@@ -1408,6 +1408,12 @@ tests_run()
        done
 }
 
+cleanup()
+{
+       pre_cleanup
+       defer_scopes_cleanup
+}
+
 multipath_eval()
 {
        local desc="$1"