]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests: forwarding: README: Mention defer, adf_
authorPetr Machata <petrm@nvidia.com>
Thu, 25 Sep 2025 17:31:56 +0000 (19:31 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 27 Sep 2025 00:48:41 +0000 (17:48 -0700)
Mention how it would be nice if new code used defer. Also if it does that
in dirtying helpers, how it would be nice if these were named adf_*.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/0764bdb9266cd516da23ddeec110e01118cf981e.1758821127.git.petrm@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/forwarding/README

index 7b41cff993adb0f32a7ab313b2b170980f428375..392a5a91ed379f454fec963dc79569064220f0cb 100644 (file)
@@ -57,6 +57,21 @@ o Code shall be checked using ShellCheck [1] prior to submission.
 
 1. https://www.shellcheck.net/
 
+Cleanups
+--------
+
+o lib.sh brings in defer.sh (by way of ../lib.sh) by default. Consider
+  making use of the defer primitive to schedule automatic cleanups. This
+  makes it harder to forget to remove a temporary netdevice, kill a running
+  process or perform other cleanup when the test script is interrupted.
+
+o When adding a helper that dirties the environment, but schedules all
+  necessary cleanups through defer, consider prefixing it adf_ for
+  consistency with lib.sh and ../lib.sh helpers. This serves as an
+  immediately visible bit of documentation about the helper API.
+
+o Definitely do the above for any new code in lib.sh, if practical.
+
 Customization
 =============