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

selftests: forwarding: README: Mention defer, adf_

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>

authored by

Petr Machata and committed by
Jakub Kicinski
fca6ff91 040a6cbe

+15
+15
tools/testing/selftests/net/forwarding/README
··· 57 57 58 58 1. https://www.shellcheck.net/ 59 59 60 + Cleanups 61 + -------- 62 + 63 + o lib.sh brings in defer.sh (by way of ../lib.sh) by default. Consider 64 + making use of the defer primitive to schedule automatic cleanups. This 65 + makes it harder to forget to remove a temporary netdevice, kill a running 66 + process or perform other cleanup when the test script is interrupted. 67 + 68 + o When adding a helper that dirties the environment, but schedules all 69 + necessary cleanups through defer, consider prefixing it adf_ for 70 + consistency with lib.sh and ../lib.sh helpers. This serves as an 71 + immediately visible bit of documentation about the helper API. 72 + 73 + o Definitely do the above for any new code in lib.sh, if practical. 74 + 60 75 Customization 61 76 ============= 62 77