Re: [PATCH v2] selftests: kvm: fix mkdir error when building for unsupported arch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/19/24 03:30, Muhammad Usama Anjum wrote:
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@xxxxxxxxxx>
Cc: Sean Christopherson <seanjc@xxxxxxxxxx>
Signed-off-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
---
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)

Looks good to me.

Reviewed-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>

thanks,
-- Shuah





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux