diff mbox series

[v2,1/6] selftests: Create directory when OUTPUT specified

Message ID 20200325140133.103236-2-xiaoyao.li@intel.com (mailing list archive)
State New
Headers show
Series Fix errors when try to build kvm selftests on specified output | expand

Commit Message

Xiaoyao Li March 25, 2020, 2:01 p.m. UTC
When OUTPUT specified, it may encounter no directory error if there is
subdir in $TARGET for any of TEST_GEN_PROGS, TEST_GEN_PROGS_EXTENDED, or
TEST_GEN_FILES.

This issue is found by running

	make OUTPUT=/path/to/output

in tools/testing/selftests/kvm

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 tools/testing/selftests/lib.mk | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index 1c8a1963d03f..78fb00bdf5c4 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -20,6 +20,16 @@  TEST_GEN_PROGS := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS))
 TEST_GEN_PROGS_EXTENDED := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_PROGS_EXTENDED))
 TEST_GEN_FILES := $(patsubst %,$(OUTPUT)/%,$(TEST_GEN_FILES))
 
+ifneq ($(TEST_GEN_PROGS),)
+$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
+endif
+ifneq ($(TEST_GEN_PROGS_EXTENDED),)
+$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS_EXTENDED))))
+endif
+ifneq ($(TEST_GEN_FILES),)
+$(shell mkdir -p $(sort $(dir $(TEST_GEN_FILES))))
+endif
+
 ifdef KSFT_KHDR_INSTALL
 top_srcdir ?= ../../../..
 include $(top_srcdir)/scripts/subarch.include