Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Benjamin Poirier and committed by
David S. Miller
4a24560a 975b4a8b

+25 -3
+15 -2
tools/testing/selftests/drivers/net/dsa/Makefile
··· 11 11 tc_actions.sh \ 12 12 test_bridge_fdb_stress.sh 13 13 14 - TEST_PROGS_EXTENDED := lib.sh tc_common.sh 14 + TEST_FILES := \ 15 + run_net_forwarding_test.sh \ 16 + forwarding.config 15 17 16 - TEST_FILES := forwarding.config 18 + TEST_INCLUDES := \ 19 + ../../../net/forwarding/bridge_locked_port.sh \ 20 + ../../../net/forwarding/bridge_mdb.sh \ 21 + ../../../net/forwarding/bridge_mld.sh \ 22 + ../../../net/forwarding/bridge_vlan_aware.sh \ 23 + ../../../net/forwarding/bridge_vlan_mcast.sh \ 24 + ../../../net/forwarding/bridge_vlan_unaware.sh \ 25 + ../../../net/forwarding/lib.sh \ 26 + ../../../net/forwarding/local_termination.sh \ 27 + ../../../net/forwarding/no_forwarding.sh \ 28 + ../../../net/forwarding/tc_actions.sh \ 29 + ../../../net/forwarding/tc_common.sh 17 30 18 31 include ../../../lib.mk
+9
tools/testing/selftests/drivers/net/dsa/run_net_forwarding_test.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + libdir=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") 5 + testname=$(basename "${BASH_SOURCE[0]}") 6 + 7 + source "$libdir"/forwarding.config 8 + cd "$libdir"/../../../net/forwarding/ || exit 1 9 + source "./$testname" "$@"
+1 -1
tools/testing/selftests/drivers/net/dsa/test_bridge_fdb_stress.sh
··· 19 19 REQUIRE_MZ="no" 20 20 NETIF_CREATE="no" 21 21 lib_dir=$(dirname "$0") 22 - source "$lib_dir"/lib.sh 22 + source "$lib_dir"/../../../net/forwarding/lib.sh 23 23 24 24 cleanup() { 25 25 echo "Cleaning up"