Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: forwarding: Add a fallback cleanup()

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>

authored by

Petr Machata and committed by
Paolo Abeni
b4b0549a a6e263f1

+6
+6
tools/testing/selftests/net/forwarding/lib.sh
··· 1408 1408 done 1409 1409 } 1410 1410 1411 + cleanup() 1412 + { 1413 + pre_cleanup 1414 + defer_scopes_cleanup 1415 + } 1416 + 1411 1417 multipath_eval() 1412 1418 { 1413 1419 local desc="$1"