selftests: dsa: Replace test symlinks by wrapper script

The dsa tests which are symlinks of tests from net/forwarding/ (like
tc_actions.sh) become regular files after export (because `rsync
--copy-unsafe-links` is used) and expect to source lib.sh
(net/forwarding/lib.sh) from the same directory.

In the last patch of this series, net/forwarding/lib.sh will source lib.sh
from its parent directory (ie. net/lib.sh). This would not work for dsa
tests because net/lib.sh is not present under drivers/net/.

Since the tests in net/forwarding/ are not meant to be copied and run from
another directory, as a preparation for that last patch, replace the test
symlinks by a wrapper script which runs the original tests under
net/forwarding/. Following from that, the links to shared library scripts
in dsa/ are no longer used so remove them and add all the original files
needed from parent directories to TEST_INCLUDES.

Suggested-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Petr Machata <petrm@nvidia.com>
Tested-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Benjamin Poirier 2024-01-26 18:21:21 -05:00 committed by David S. Miller
parent 975b4a8b68
commit 4a24560ad7
14 changed files with 34 additions and 14 deletions

View File

@ -11,8 +11,21 @@ TEST_PROGS = bridge_locked_port.sh \
tc_actions.sh \
test_bridge_fdb_stress.sh
TEST_PROGS_EXTENDED := lib.sh tc_common.sh
TEST_FILES := \
run_net_forwarding_test.sh \
forwarding.config
TEST_FILES := forwarding.config
TEST_INCLUDES := \
../../../net/forwarding/bridge_locked_port.sh \
../../../net/forwarding/bridge_mdb.sh \
../../../net/forwarding/bridge_mld.sh \
../../../net/forwarding/bridge_vlan_aware.sh \
../../../net/forwarding/bridge_vlan_mcast.sh \
../../../net/forwarding/bridge_vlan_unaware.sh \
../../../net/forwarding/lib.sh \
../../../net/forwarding/local_termination.sh \
../../../net/forwarding/no_forwarding.sh \
../../../net/forwarding/tc_actions.sh \
../../../net/forwarding/tc_common.sh
include ../../../lib.mk

View File

@ -1 +1 @@
../../../net/forwarding/bridge_locked_port.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/bridge_mdb.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/bridge_mld.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/bridge_vlan_aware.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/bridge_vlan_mcast.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/bridge_vlan_unaware.sh
run_net_forwarding_test.sh

View File

@ -1 +0,0 @@
../../../net/forwarding/lib.sh

View File

@ -1 +1 @@
../../../net/forwarding/local_termination.sh
run_net_forwarding_test.sh

View File

@ -1 +1 @@
../../../net/forwarding/no_forwarding.sh
run_net_forwarding_test.sh

View File

@ -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" "$@"

View File

@ -1 +1 @@
../../../net/forwarding/tc_actions.sh
run_net_forwarding_test.sh

View File

@ -1 +0,0 @@
../../../net/forwarding/tc_common.sh

View File

@ -19,7 +19,7 @@ REQUIRE_JQ="no"
REQUIRE_MZ="no"
NETIF_CREATE="no"
lib_dir=$(dirname "$0")
source "$lib_dir"/lib.sh
source "$lib_dir"/../../../net/forwarding/lib.sh
cleanup() {
echo "Cleaning up"