From: Hangbin Liu <liuhangbin@gmail.com>
To: Petr Machata <petrm@nvidia.com>
Cc: "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, Shuah Khan <shuah@kernel.org>,
mlxsw@nvidia.com
Subject: Re: [PATCH net-next] selftests: forwarding: Import top-level lib.sh through $lib_dir
Date: Mon, 11 Dec 2023 20:44:54 +0800 [thread overview]
Message-ID: <ZXcERjbKl2JFClEz@Laptop-X1> (raw)
In-Reply-To: <a1c56680a5041ae337a6a44a7091bd8f781c1970.1702295081.git.petrm@nvidia.com>
On Mon, Dec 11, 2023 at 01:01:06PM +0100, Petr Machata wrote:
> The commit cited below moved code from net/forwarding/lib.sh to net/lib.sh,
> and had the former source the latter. This causes issues with selftests
> from directories other than net/forwarding/, in particular drivers/net/...
> For those files, the line "source ../lib.sh" would look for lib.sh in the
> directory above the script file's one, which is incorrect. The way these
> selftests source net/forwarding/lib.sh is like this:
>
> lib_dir=$(dirname $0)/../../../net/forwarding
> source $lib_dir/lib.sh
>
> Reuse the variable lib_dir, if set, in net/forwarding/lib.sh to source
> net/lib.sh as well.
>
> Fixes: 25ae948b4478 ("selftests/net: add lib.sh")
> Cc: Hangbin Liu <liuhangbin@gmail.com>
> Signed-off-by: Petr Machata <petrm@nvidia.com>
> ---
> tools/testing/selftests/net/forwarding/lib.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
> index 038b7d956722..0feb4e400110 100755
> --- a/tools/testing/selftests/net/forwarding/lib.sh
> +++ b/tools/testing/selftests/net/forwarding/lib.sh
> @@ -38,7 +38,7 @@ if [[ -f $relative_path/forwarding.config ]]; then
> source "$relative_path/forwarding.config"
> fi
>
> -source ../lib.sh
> +source ${lib_dir-.}/../lib.sh
> ##############################################################################
> # Sanity checks
Hi Petr,
Thanks for the report. However, this doesn't fix the soft link scenario. e.g.
The bonding tests tools/testing/selftests/drivers/net/bonding add a soft link
net_forwarding_lib.sh and source it directly in dev_addr_lists.sh.
So how about something like:
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 8f6ca458af9a..7f90248e05d6 100755
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -38,7 +38,8 @@ if [[ -f $relative_path/forwarding.config ]]; then
source "$relative_path/forwarding.config"
fi
-source ../lib.sh
+forwarding_dir=$(dirname $(readlink -f $BASH_SOURCE))
+source ${forwarding_dir}/../lib.sh
Thanks
Hangbin
next prev parent reply other threads:[~2023-12-11 12:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 12:01 [PATCH net-next] selftests: forwarding: Import top-level lib.sh through $lib_dir Petr Machata
2023-12-11 12:44 ` Hangbin Liu [this message]
2023-12-12 17:22 ` Petr Machata
2023-12-12 20:17 ` Benjamin Poirier
2023-12-13 6:00 ` Hangbin Liu
2023-12-13 21:40 ` Benjamin Poirier
2023-12-14 7:06 ` Hangbin Liu
2023-12-14 22:00 ` Benjamin Poirier
2023-12-15 2:35 ` Hangbin Liu
2023-12-15 23:30 ` Benjamin Poirier
2023-12-21 16:58 ` Vladimir Oltean
2023-12-22 14:09 ` Benjamin Poirier
2023-12-13 10:03 ` Petr Machata
2023-12-13 10:31 ` Petr Machata
2023-12-14 6:57 ` 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=ZXcERjbKl2JFClEz@Laptop-X1 \
--to=liuhangbin@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--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