Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<netdev@vger.kernel.org>
Cc: Simon Horman <horms@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
	"Nikolay Aleksandrov" <razor@blackwall.org>,
	Petr Machata <petrm@nvidia.com>, "Shuah Khan" <shuah@kernel.org>,
	<linux-kselftest@vger.kernel.org>, <mlxsw@nvidia.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	"KuniyNicolas Dichtel" <nicolas.dichtel@6wind.com>
Subject: [PATCH net-next 13/13] selftests: forwarding: README: Mention defer, adf_
Date: Thu, 25 Sep 2025 19:31:56 +0200	[thread overview]
Message-ID: <0764bdb9266cd516da23ddeec110e01118cf981e.1758821127.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1758821127.git.petrm@nvidia.com>

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>
---

Notes:
CC: Kuniyuki Iwashima <kuniyu@google.com>
CC: KuniyNicolas Dichtel <nicolas.dichtel@6wind.com>

 tools/testing/selftests/net/forwarding/README | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/README b/tools/testing/selftests/net/forwarding/README
index 7b41cff993ad..392a5a91ed37 100644
--- a/tools/testing/selftests/net/forwarding/README
+++ b/tools/testing/selftests/net/forwarding/README
@@ -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
 =============
 
-- 
2.49.0


  parent reply	other threads:[~2025-09-25 17:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 17:31 [PATCH net-next 00/13] selftests: Mark auto-deferring functions clearly Petr Machata
2025-09-25 17:31 ` [PATCH net-next 01/13] selftests: net: lib: Rename ip_link_add() to adf_* Petr Machata
2025-09-26 13:53   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 02/13] selftests: net: lib: Rename ip_link_set_master() " Petr Machata
2025-09-26 13:54   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 03/13] selftests: net: lib: Rename ip_link_set_addr() " Petr Machata
2025-09-26 13:54   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 04/13] selftests: net: lib: Rename ip_link_set_up() " Petr Machata
2025-09-26 13:54   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 05/13] selftests: net: lib: Rename ip_link_set_down() " Petr Machata
2025-09-26 13:54   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 06/13] selftests: net: lib: Rename ip_addr_add() " Petr Machata
2025-09-26 13:55   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 07/13] selftests: net: lib: Rename ip_route_add() " Petr Machata
2025-09-26 13:55   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 08/13] selftests: net: lib: Rename bridge_vlan_add() " Petr Machata
2025-09-26 13:55   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 09/13] selftests: net: vlan_bridge_binding: Rename dfr_set_binding_*() " Petr Machata
2025-09-26 13:55   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 10/13] selftests: forwarding: lib: Add an autodefer variant of vrf_prepare() Petr Machata
2025-09-26 13:55   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 11/13] selftests: forwarding: lib: Add an autodefer variant of simple_if_init() Petr Machata
2025-09-26 13:56   ` Simon Horman
2025-09-25 17:31 ` [PATCH net-next 12/13] selftests: forwarding: lib: Add an autodefer variant of forwarding_enable() Petr Machata
2025-09-26 13:56   ` Simon Horman
2025-09-25 17:31 ` Petr Machata [this message]
2025-09-26 13:56   ` [PATCH net-next 13/13] selftests: forwarding: README: Mention defer, adf_ Simon Horman
2025-09-27  1:20 ` [PATCH net-next 00/13] selftests: Mark auto-deferring functions clearly patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0764bdb9266cd516da23ddeec110e01118cf981e.1758821127.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.dichtel@6wind.com \
    --cc=pabeni@redhat.com \
    --cc=razor@blackwall.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox