[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240819093030.2864163-1-usama.anjum@collabora.com>
Date: Mon, 19 Aug 2024 14:30:28 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Shuah Khan <shuah@...nel.org>
Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>,
kernel@...labora.com,
Sean Christopherson <seanjc@...gle.com>,
kvm@...r.kernel.org,
linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] selftests: kvm: fix mkdir error when building for unsupported arch
The tests are built on per architecture basis. When unsupported
architecture is specified, it has no tests and TEST_GEN_PROGS is empty.
The lib.mk has support for not building anything for such case. But KVM
makefile doesn't handle such case correctly. It doesn't check if
TEST_GEN_PROGS is empty or not and try to create directory by mkdir.
Hence mkdir generates the error.
mkdir: missing operand
Try 'mkdir --help' for more information.
This can be easily fixed by checking if TEST_GEN_PROGS isn't empty
before calling mkdir.
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Sean Christopherson <seanjc@...gle.com>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
---
Changes since v1:
- Instead of ignoring error, check TEST_GEN_PROGS's validity first
---
tools/testing/selftests/kvm/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 48d32c5aa3eb7..9f8ed82ff1d65 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -317,7 +317,9 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
+ifneq ($(strip $(TEST_GEN_PROGS)),)
$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
+endif
$(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS)
$(TEST_GEN_PROGS): $(LIBKVM_OBJS)
$(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
--
2.39.2
Powered by blists - more mailing lists