On 10/12/22 20:40, Benjamin Poirier wrote:
On 2022-10-12 10:17 -0400, Jonathan Toppins wrote:
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?
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?
This looks good to me. I might rename `lib.sh` to `net_lib.sh` but that
is just a nit.
-Jon
diff --git a/tools/testing/selftests/drivers/net/bonding/Makefile b/tools/testing/selftests/drivers/net/bonding/Makefile
index e9dab5f9d773..7c50bfc24d32 100644
--- a/tools/testing/selftests/drivers/net/bonding/Makefile
+++ b/tools/testing/selftests/drivers/net/bonding/Makefile
@@ -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
diff --git a/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh b/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
index e6fa24eded5b..7b79f090ddaa 100755
--- a/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
+++ b/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
@@ -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
diff --git a/tools/testing/selftests/drivers/net/bonding/lib.sh b/tools/testing/selftests/drivers/net/bonding/lib.sh
new file mode 120000
index 000000000000..39c96828c5ef
--- /dev/null
+++ b/tools/testing/selftests/drivers/net/bonding/lib.sh
@@ -0,0 +1 @@
+../../../net/forwarding/lib.sh
\ No newline at end of file
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 9d4cb94cf437..6203d3993554 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -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