Skip to content

Commit

Permalink
selftests: dsa: Replace test symlinks by wrapper script
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Benjamin Poirier authored and David S. Miller committed Jan 31, 2024
1 parent 975b4a8 commit 4a24560
Show file tree
Hide file tree
Showing 14 changed files with 34 additions and 14 deletions.
17 changes: 15 additions & 2 deletions tools/testing/selftests/drivers/net/dsa/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tools/testing/selftests/drivers/net/dsa/bridge_mdb.sh
2 changes: 1 addition & 1 deletion tools/testing/selftests/drivers/net/dsa/bridge_mld.sh
1 change: 0 additions & 1 deletion tools/testing/selftests/drivers/net/dsa/lib.sh

This file was deleted.

2 changes: 1 addition & 1 deletion tools/testing/selftests/drivers/net/dsa/no_forwarding.sh
Original file line number Diff line number Diff line change
@@ -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" "$@"
2 changes: 1 addition & 1 deletion tools/testing/selftests/drivers/net/dsa/tc_actions.sh
1 change: 0 additions & 1 deletion tools/testing/selftests/drivers/net/dsa/tc_common.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4a24560

Please sign in to comment.