diff mbox series

[for-next,2/2] selftests/Makefile: add INSTALL_DEP_TARGETS to run_tests

Message ID 20241219085803.1145606-3-lizhijian@fujitsu.com
State New
Headers show
Series selftests: Fix run_tests and install for net TARGET | expand

Commit Message

Li Zhijian Dec. 19, 2024, 8:58 a.m. UTC
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@fujitsu.com>
---
 tools/testing/selftests/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

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)                   \