public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests: kvm: fix mkdir error when building for unsupported arch
@ 2024-08-19  9:30 Muhammad Usama Anjum
  2024-08-19 10:01 ` Shuah Khan
  2024-08-19 16:33 ` Sean Christopherson
  0 siblings, 2 replies; 6+ messages in thread
From: Muhammad Usama Anjum @ 2024-08-19  9:30 UTC (permalink / raw)
  To: Paolo Bonzini, Shuah Khan
  Cc: Muhammad Usama Anjum, kernel, Sean Christopherson, kvm,
	linux-kselftest, linux-kernel

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@redhat.com>
Cc: Sean Christopherson <seanjc@google.com>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-20  7:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-19  9:30 [PATCH v2] selftests: kvm: fix mkdir error when building for unsupported arch Muhammad Usama Anjum
2024-08-19 10:01 ` Shuah Khan
2024-08-19 16:33 ` Sean Christopherson
2024-08-19 22:15   ` Oliver Upton
2024-08-20  6:40     ` Marc Zyngier
2024-08-20  7:26   ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox