Skip to content

Commit

Permalink
selftests: net: Fix cross-tree inclusion of scripts
Browse files Browse the repository at this point in the history
When exporting and running a subset of selftests via kselftest, files from
parts of the source tree which were not exported are not available. A few
tests are trying to source such files. Address the problem by using
symlinks.

The problem can be reproduced by running:
make -C tools/testing/selftests gen_tar TARGETS="drivers/net/bonding"
[... extract archive ...]
./run_kselftest.sh

or:
make kselftest KBUILD_OUTPUT=/tmp/kselftests TARGETS="drivers/net/bonding"

Fixes: bbb774d ("net: Add tests for bonding and team address list management")
Fixes: eccd0a8 ("selftests: net: dsa: add a stress test for unlocked FDB operations")
Link: https://lore.kernel.org/netdev/40f04ded-0c86-8669-24b1-9a313ca21076@redhat.com/
Reported-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Reviewed-by: Jonathan Toppins <jtoppins@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
gobenji authored and kuba-moo committed Oct 21, 2022
1 parent f8c1c66 commit ae108c4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 8 deletions.
4 changes: 3 additions & 1 deletion tools/testing/selftests/drivers/net/bonding/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ TEST_PROGS := \
bond-lladdr-target.sh \
dev_addr_lists.sh

TEST_FILES := lag_lib.sh
TEST_FILES := \
lag_lib.sh \
net_forwarding_lib.sh

include ../../../lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ALL_TESTS="
REQUIRE_MZ=no
NUM_NETIFS=0
lib_dir=$(dirname "$0")
source "$lib_dir"/../../../net/forwarding/lib.sh
source "$lib_dir"/net_forwarding_lib.sh

source "$lib_dir"/lag_lib.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ NUM_NETIFS=1
REQUIRE_JQ="no"
REQUIRE_MZ="no"
NETIF_CREATE="no"
lib_dir=$(dirname $0)/../../../net/forwarding
source $lib_dir/lib.sh
lib_dir=$(dirname "$0")
source "$lib_dir"/lib.sh

cleanup() {
echo "Cleaning up"
Expand Down
4 changes: 4 additions & 0 deletions tools/testing/selftests/drivers/net/team/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@

TEST_PROGS := dev_addr_lists.sh

TEST_FILES := \
lag_lib.sh \
net_forwarding_lib.sh

include ../../../lib.mk
4 changes: 2 additions & 2 deletions tools/testing/selftests/drivers/net/team/dev_addr_lists.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ALL_TESTS="
REQUIRE_MZ=no
NUM_NETIFS=0
lib_dir=$(dirname "$0")
source "$lib_dir"/../../../net/forwarding/lib.sh
source "$lib_dir"/net_forwarding_lib.sh

source "$lib_dir"/../bonding/lag_lib.sh
source "$lib_dir"/lag_lib.sh


destroy()
Expand Down
1 change: 1 addition & 0 deletions tools/testing/selftests/drivers/net/team/lag_lib.sh
4 changes: 2 additions & 2 deletions tools/testing/selftests/lib.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ endef
run_tests: all
ifdef building_out_of_srctree
@if [ "X$(TEST_PROGS)$(TEST_PROGS_EXTENDED)$(TEST_FILES)" != "X" ]; then \
rsync -aq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
rsync -aLq $(TEST_PROGS) $(TEST_PROGS_EXTENDED) $(TEST_FILES) $(OUTPUT); \
fi
@if [ "X$(TEST_PROGS)" != "X" ]; then \
$(call RUN_TESTS, $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) \
Expand All @@ -84,7 +84,7 @@ endif

define INSTALL_SINGLE_RULE
$(if $(INSTALL_LIST),@mkdir -p $(INSTALL_PATH))
$(if $(INSTALL_LIST),rsync -a $(INSTALL_LIST) $(INSTALL_PATH)/)
$(if $(INSTALL_LIST),rsync -aL $(INSTALL_LIST) $(INSTALL_PATH)/)
endef

define INSTALL_RULE
Expand Down

0 comments on commit ae108c4

Please sign in to comment.