Skip to content

Commit 87d8fb1

Browse files
Yuval Mintzdavem330
authored andcommitted
selftests: forwarding: Allow lib.sh sourcing from other directories
The devlink related scripts are mlxsw-specific. As a result, they'll reside in a different directory - but would still need the common logic implemented in lib.sh. So as a preliminary step, allow lib.sh to be sourced from other directories as well. Signed-off-by: Yuval Mintz <yuvalm@mellanox.com> Signed-off-by: Petr Machata <petrm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a847726 commit 87d8fb1

File tree

1 file changed

+7
-2
lines changed
  • tools/testing/selftests/net/forwarding

1 file changed

+7
-2
lines changed

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no}
1414
NETIF_TYPE=${NETIF_TYPE:=veth}
1515
NETIF_CREATE=${NETIF_CREATE:=yes}
1616

17-
if [[ -f forwarding.config ]]; then
18-
source forwarding.config
17+
relative_path="${BASH_SOURCE%/*}"
18+
if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
19+
relative_path="."
20+
fi
21+
22+
if [[ -f $relative_path/forwarding.config ]]; then
23+
source "$relative_path/forwarding.config"
1924
fi
2025

2126
##############################################################################

0 commit comments

Comments
 (0)