public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Poirier <bpoirier@nvidia.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: netdev@vger.kernel.org, Shuah Khan <shuah@kernel.org>,
	Petr Machata <petrm@nvidia.com>,
	Hangbin Liu <liuhangbin@gmail.com>
Subject: Re: [RFC PATCH net-next 10/10] selftests: dsa: Replace symlinks by wrapper script
Date: Thu, 28 Dec 2023 14:36:58 -0500	[thread overview]
Message-ID: <ZY3OWvnuzk59TU2K@d3> (raw)
In-Reply-To: <20231227201129.rvux4i5pklo5v5ie@skbuf>

On 2023-12-27 22:11 +0200, Vladimir Oltean wrote:
> On Fri, Dec 22, 2023 at 08:58:36AM -0500, Benjamin Poirier wrote:
> > diff --git a/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh b/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
> > new file mode 100755
> > index 000000000000..4106c0a102ea
> > --- /dev/null
> > +++ b/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
> > @@ -0,0 +1,9 @@
> > +#!/bin/bash
> > +# SPDX-License-Identifier: GPL-2.0
> > +
> > +libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
> > +testname=$(basename "${BASH_SOURCE[0]}")
> > +
> > +source "$libdir"/forwarding.config
> > +cd "$libdir"/../../../net/forwarding/ || exit 1
> > +source "./$testname" "$@"
> 
> Thanks for working on this. I don't dislike the solution. Just one
> question.  Can "run_net_forwarding_test.sh" be one day moved from
> tools/testing/selftests/drivers/net/dsa/ without duplicating it,
> should anyone else need the same setup?

Yes, it's possible. I didn't think about it before but I tested the
approach below. It applies over the changes I just sent in my previous
mail about patch 5.

Thank you for your review and suggestions.

diff --git a/tools/testing/selftests/drivers/net/dsa/Makefile b/tools/testing/selftests/drivers/net/dsa/Makefile
index cd6817fe5be6..5ff77c851642 100644
--- a/tools/testing/selftests/drivers/net/dsa/Makefile
+++ b/tools/testing/selftests/drivers/net/dsa/Makefile
@@ -12,10 +12,10 @@ TEST_PROGS = bridge_locked_port.sh \
 	test_bridge_fdb_stress.sh
 
 TEST_FILES := \
-	run_net_forwarding_test.sh \
 	forwarding.config
 
 TEST_INCLUDES := \
+	run_net_forwarding_test.sh \
 	../../../net/forwarding/bridge_locked_port.sh \
 	../../../net/forwarding/bridge_mdb.sh \
 	../../../net/forwarding/bridge_mld.sh \
@@ -25,6 +25,7 @@ TEST_INCLUDES := \
 	../../../net/forwarding/lib.sh \
 	../../../net/forwarding/local_termination.sh \
 	../../../net/forwarding/no_forwarding.sh \
+	../../../net/forwarding/run_net_forwarding_test.sh \
 	../../../net/forwarding/tc_actions.sh \
 	../../../net/forwarding/tc_common.sh \
 	../../../net/lib.sh
diff --git a/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh b/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
deleted file mode 100755
index 4106c0a102ea..000000000000
--- a/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: GPL-2.0
-
-libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
-testname=$(basename "${BASH_SOURCE[0]}")
-
-source "$libdir"/forwarding.config
-cd "$libdir"/../../../net/forwarding/ || exit 1
-source "./$testname" "$@"
diff --git a/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh b/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
new file mode 120000
index 000000000000..2e7e656349e6
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
@@ -0,0 +1 @@
+../../../net/forwarding/run_net_forwarding_test.sh
\ No newline at end of file
diff --git a/tools/testing/selftests/net/forwarding/run_net_forwarding_test.sh b/tools/testing/selftests/net/forwarding/run_net_forwarding_test.sh
new file mode 100755
index 000000000000..cfddadb57fe7
--- /dev/null
+++ b/tools/testing/selftests/net/forwarding/run_net_forwarding_test.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+linkdir=$(readlink -f "$(dirname "$0")")
+libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
+testname=$(basename "${BASH_SOURCE[0]}")
+
+source "$linkdir"/forwarding.config
+cd "$libdir" || exit 1
+source "./$testname" "$@"

  reply	other threads:[~2023-12-28 19:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 13:58 [RFC PATCH net-next 00/10] selftests: Add TEST_INCLUDES directive and adjust tests to use it Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 01/10] selftests: bonding: Change script interpreter Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 02/10] selftests: forwarding: Remove executable bits from lib.sh Benjamin Poirier
2023-12-27 19:24   ` Vladimir Oltean
2023-12-22 13:58 ` [RFC PATCH net-next 03/10] selftests: forwarding: Import top-level lib.sh through absolute path Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 04/10] selftests: forwarding: Simplify forwarding.config import logic Benjamin Poirier
2023-12-27 19:27   ` Vladimir Oltean
2023-12-28 19:07     ` Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 05/10] selftests: Introduce Makefile variable to list shared bash scripts Benjamin Poirier
2023-12-27 19:43   ` Vladimir Oltean
2023-12-27 19:47     ` Vladimir Oltean
2023-12-28 19:28       ` Benjamin Poirier
2023-12-28 20:38         ` Vladimir Oltean
2023-12-22 13:58 ` [RFC PATCH net-next 06/10] selftests: forwarding: Add net/lib.sh to TEST_INCLUDES Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 07/10] selftests: bonding: Add lib.sh scripts " Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 08/10] selftests: team: " Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 09/10] selftests: team: Add shared library script " Benjamin Poirier
2023-12-22 13:58 ` [RFC PATCH net-next 10/10] selftests: dsa: Replace symlinks by wrapper script Benjamin Poirier
2023-12-27 20:11   ` Vladimir Oltean
2023-12-28 19:36     ` Benjamin Poirier [this message]
2023-12-28 20:33       ` Vladimir Oltean
2023-12-23  9:27 ` [RFC PATCH net-next 00/10] selftests: Add TEST_INCLUDES directive and adjust tests to use it Hangbin Liu

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=ZY3OWvnuzk59TU2K@d3 \
    --to=bpoirier@nvidia.com \
    --cc=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=petrm@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=vladimir.oltean@nxp.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