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: <linux-kselftest@vger.kernel.org>, Shuah Khan <shuah@kernel.org>,
	"Benjamin Poirier" <bpoirier@nvidia.com>,
	Hangbin Liu <liuhangbin@gmail.com>,
	"Vladimir Oltean" <vladimir.oltean@nxp.com>,
	Ido Schimmel <idosch@nvidia.com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
	Petr Machata <petrm@nvidia.com>,
	Willem de Bruijn <willemb@google.com>, <mlxsw@nvidia.com>
Subject: [PATCH net-next v2 02/10] selftests: forwarding: Add a fallback cleanup()
Date: Thu, 17 Oct 2024 11:45:44 +0200	[thread overview]
Message-ID: <5204bce5de00855aae83bc66d8d6bc7b93a035ce.1729157566.git.petrm@nvidia.com> (raw)
In-Reply-To: <cover.1729157566.git.petrm@nvidia.com>

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>
---
 tools/testing/selftests/net/forwarding/lib.sh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index d24b6af7ebfa..76e6d7698caf 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -1408,6 +1408,12 @@ tests_run()
 	done
 }
 
+cleanup()
+{
+	pre_cleanup
+	defer_scopes_cleanup
+}
+
 multipath_eval()
 {
 	local desc="$1"
-- 
2.45.0


  parent reply	other threads:[~2024-10-17  9:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17  9:45 [PATCH net-next v2 00/10] selftests: net: Introduce deferred commands Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 01/10] selftests: net: lib: " Petr Machata
2024-10-17  9:45 ` Petr Machata [this message]
2024-10-17  9:45 ` [PATCH net-next v2 03/10] selftests: forwarding: lib: Allow passing PID to stop_traffic() Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 04/10] selftests: RED: Use defer for test cleanup Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 05/10] selftests: TBF: " Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 06/10] selftests: ETS: " Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 07/10] selftests: mlxsw: qos_mc_aware: " Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 08/10] selftests: mlxsw: qos_ets_strict: " Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 09/10] selftests: mlxsw: qos_max_descriptors: " Petr Machata
2024-10-17  9:45 ` [PATCH net-next v2 10/10] selftests: mlxsw: devlink_trap_police: " Petr Machata
2024-10-22 11:50 ` [PATCH net-next v2 00/10] selftests: net: Introduce deferred commands 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=5204bce5de00855aae83bc66d8d6bc7b93a035ce.1729157566.git.petrm@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=bpoirier@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=mlxsw@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemb@google.com \
    /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