netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: forwarding: Import top-level lib.sh through $lib_dir
@ 2023-12-11 12:01 Petr Machata
  2023-12-11 12:44 ` Hangbin Liu
  0 siblings, 1 reply; 15+ messages in thread
From: Petr Machata @ 2023-12-11 12:01 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev
  Cc: Shuah Khan, Petr Machata, mlxsw, Hangbin Liu

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


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2023-12-22 14:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).