selftests: forwarding: devlink_lib: Avoid double sourcing of lib.sh
authorPetr Machata <petrm@mellanox.com>
Thu, 28 Mar 2019 12:12:23 +0000 (12:12 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Mar 2019 00:20:52 +0000 (17:20 -0700)
Don't source lib.sh twice and make the script work with ifnames passed
on the command line.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/drivers/net/mlxsw/spectrum-2/tc_flower.sh
tools/testing/selftests/drivers/net/mlxsw/spectrum/devlink_resources.sh
tools/testing/selftests/drivers/net/mlxsw/spectrum/resource_scale.sh
tools/testing/selftests/net/forwarding/devlink_lib.sh

index a372b2f60874d2a62905f763777717009fd31143..fb850e0ec8375f143c8da0459ee48ca778bb3a29 100755 (executable)
@@ -12,6 +12,7 @@ ALL_TESTS="single_mask_test identical_filters_test two_masks_test \
        delta_two_masks_one_key_test delta_simple_rehash_test \
        bloom_simple_test bloom_complex_test bloom_delta_test"
 NUM_NETIFS=2
+source $lib_dir/lib.sh
 source $lib_dir/tc_common.sh
 source $lib_dir/devlink_lib.sh
 
index b1fe960e398a8da6846e36289c8cb178b03bcc56..6f2683cbc7d5ce8202ec571418bcb5595dfa5101 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+lib_dir=$(dirname $0)/../../../../net/forwarding
+
 NUM_NETIFS=1
+source $lib_dir/lib.sh
 source devlink_lib_spectrum.sh
 
 setup_prepare()
index e7ffc79561b7770fc9918afc1a72fe2ccb96a146..43ba1b438f6dbad35bdcb3b65b494f7addd25025 100755 (executable)
@@ -1,8 +1,11 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
+lib_dir=$(dirname $0)/../../../../net/forwarding
+
 NUM_NETIFS=6
-source ../../../../net/forwarding/tc_common.sh
+source $lib_dir/lib.sh
+source $lib_dir/tc_common.sh
 source devlink_lib_spectrum.sh
 
 current_test=""
index 57cf8914910d897f2514d604062365f640d09c87..981b897d418d7bf420e83cf3e99e3dbffcd4fc95 100644 (file)
@@ -1,16 +1,6 @@
 #!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
-##############################################################################
-# Source library
-
-relative_path="${BASH_SOURCE%/*}"
-if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
-       relative_path="."
-fi
-
-source "$relative_path/lib.sh"
-
 ##############################################################################
 # Defines