Skip to contentSkip to conversation

kselftest: bonding: dev_addr_lists.sh doesn't run due to lack of dependencies

DISCUSSION Jonathan Toppins 2 participants 3 messages Oct 12, 2022 – Oct 17, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

When kselftest for bonding is built like:

$ make TARGETS="drivers/net/bonding" -j8 -C tools/testing/selftests gen_tar

and then run on the target:

$ ./run_kselftest.sh
[...]
# selftests: drivers/net/bonding: dev_addr_lists.sh
# ./dev_addr_lists.sh: line 17: ./../../../net/forwarding/lib.sh: No such file or directory
# ./dev_addr_lists.sh: line 107: tests_run: command not found
# ./dev_addr_lists.sh: line 109: exit: : numeric argument required
# ./dev_addr_lists.sh: line 34: pre_cleanup: command not found
not ok 4 selftests: drivers/net/bonding: dev_addr_lists.sh # exit=2
[...]

I am still new to kselftests is this expected or is there some way in the make machinery to force packaging of net as well?

Thanks,
-Jon

#1 lore raw
Quoted 15 lines · Jonathan Toppins

When kselftest for bonding is built like:

$ make TARGETS="drivers/net/bonding" -j8 -C tools/testing/selftests gen_tar

and then run on the target:

$ ./run_kselftest.sh
[...]
# selftests: drivers/net/bonding: dev_addr_lists.sh
# ./dev_addr_lists.sh: line 17: ./../../../net/forwarding/lib.sh: No such
file or directory
# ./dev_addr_lists.sh: line 107: tests_run: command not found
# ./dev_addr_lists.sh: line 109: exit: : numeric argument required
# ./dev_addr_lists.sh: line 34: pre_cleanup: command not found
not ok 4 selftests: drivers/net/bonding: dev_addr_lists.sh # exit=2
[...]
Quoted 3 lines

I am still new to kselftests is this expected or is there some way in the make machinery to force packaging of net as well?

Arg, I didn't know that you could export just a part of the selftest tree. Thanks for the report.

I'm traveling for a few days. I'll look into how to fix the inclusion problem when I get back on October 19th.

In the meantime, if you just want to run the bonding tests you can do:

(in tree)
make -C tools/testing/selftests run_tests TARGETS="drivers/net/bonding"

or

(exported)
make -C tools/testing/selftests gen_tar
[... extract archive ...]
./run_kselftest.sh -c drivers/net/bonding

It seems like a plausible fix might be to use symlinks, what do you think?

tools/testing/selftests/drivers/net/bonding/Makefile +3 -1
index e9dab5f9d773..7c50bfc24d32 100644
@@ -7,6 +7,8 @@ TEST_PROGS := \
 	bond-lladdr-target.sh \
 	dev_addr_lists.sh
 
-TEST_FILES := lag_lib.sh
+TEST_FILES := \
+	lag_lib.sh \
+	lib.sh
 
 include ../../../lib.mk
tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh +1 -1
index e6fa24eded5b..7b79f090ddaa 100755
@@ -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"/lib.sh
 
 source "$lib_dir"/lag_lib.sh
 
tools/testing/selftests/drivers/net/bonding/lib.sh new file +1 -0
new file mode 120000
index 000000000000..39c96828c5ef
@@ -0,0 +1 @@
+../../../net/forwarding/lib.sh
\ No newline at end of file
tools/testing/selftests/lib.mk +1 -1
index 9d4cb94cf437..6203d3993554 100644
@@ -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
#2 lore raw
Quoted 33 lines · Benjamin Poirier
Quoted 15 lines · Jonathan Toppins

When kselftest for bonding is built like:

$ make TARGETS="drivers/net/bonding" -j8 -C tools/testing/selftests gen_tar

and then run on the target:

$ ./run_kselftest.sh
[...]
# selftests: drivers/net/bonding: dev_addr_lists.sh
# ./dev_addr_lists.sh: line 17: ./../../../net/forwarding/lib.sh: No such
file or directory
# ./dev_addr_lists.sh: line 107: tests_run: command not found
# ./dev_addr_lists.sh: line 109: exit: : numeric argument required
# ./dev_addr_lists.sh: line 34: pre_cleanup: command not found
not ok 4 selftests: drivers/net/bonding: dev_addr_lists.sh # exit=2
[...]
Quoted 3 lines

I am still new to kselftests is this expected or is there some way in the make machinery to force packaging of net as well?

Arg, I didn't know that you could export just a part of the selftest tree. Thanks for the report.

I'm traveling for a few days. I'll look into how to fix the inclusion problem when I get back on October 19th.

In the meantime, if you just want to run the bonding tests you can do:

(in tree)
make -C tools/testing/selftests run_tests TARGETS="drivers/net/bonding"

or

Quoted 8 lines

(exported)
make -C tools/testing/selftests gen_tar
[... extract archive ...]
./run_kselftest.sh -c drivers/net/bonding

It seems like a plausible fix might be to use symlinks, what do you think?

This looks good to me. I might rename lib.sh to net_lib.sh but that is just a nit.

-Jon

Quoted 50 lines
tools/testing/selftests/drivers/net/bonding/Makefile +3 -1
index e9dab5f9d773..7c50bfc24d32 100644
@@ -7,6 +7,8 @@ TEST_PROGS := \
  	bond-lladdr-target.sh \
  	dev_addr_lists.sh
 
-TEST_FILES := lag_lib.sh
+TEST_FILES := \
+	lag_lib.sh \
+	lib.sh
 
  include ../../../lib.mk
tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh +1 -1
index e6fa24eded5b..7b79f090ddaa 100755
@@ -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"/lib.sh
 
  source "$lib_dir"/lag_lib.sh
 
tools/testing/selftests/drivers/net/bonding/lib.sh new file +1 -0
new file mode 120000
index 000000000000..39c96828c5ef
@@ -0,0 +1 @@
+../../../net/forwarding/lib.sh
\ No newline at end of file
tools/testing/selftests/lib.mk +1 -1
index 9d4cb94cf437..6203d3993554 100644
@@ -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