[PATCH for-next 2/2] selftests/Makefile: add INSTALL_DEP_TARGETS to run_tests
From: Li Zhijian
Date: Thu Dec 19 2024 - 03:57:55 EST
Similar to the installation process, run_tests out-of-tree requires
copying TEST_FILES and TEST_INCLUDES to the OUTPUT directory.
The `net/lib` directory is a special case because it is a dependency for
`net`. Therefore, it should be processed before `net`.
This patch fixes the following error:
$ make O=$build/ TARGETS=net kselftest V=1
# selftests: net: rtnetlink.sh
# lib.sh: line 5: $O/kselftest/net/lib/sh/defer.sh: No such file or directory
# FAIL: cannot add dummy interface
not ok 20 selftests: net: rtnetlink.sh # exit=1
# timeout set to 3600
# selftests: net: xfrm_policy.sh
# lib.sh: line 5: $O/kselftest/net/lib/sh/defer.sh: No such file or directory
Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
---
tools/testing/selftests/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index fcaebd122d64..326dfd6ec497 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -206,8 +206,9 @@ all:
done; exit $$ret;
run_tests: all
- @for TARGET in $(TARGETS); do \
+ @for TARGET in $(INSTALL_DEP_TARGETS) $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
+ mkdir -p $$BUILD_TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \
SRC_PATH=$(shell readlink -e $$(pwd)) \
OBJ_PATH=$(BUILD) \
--
2.44.0