Skip to content

Commit fca6ff9

Browse files
pmachatakuba-moo
authored andcommitted
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>
1 parent 040a6cb commit fca6ff9

File tree

1 file changed

+15
-0
lines changed
  • tools/testing/selftests/net/forwarding

1 file changed

+15
-0
lines changed

tools/testing/selftests/net/forwarding/README

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ o Code shall be checked using ShellCheck [1] prior to submission.
5757

5858
1. https://www.shellcheck.net/
5959

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+
6075
Customization
6176
=============
6277

0 commit comments

Comments
 (0)