* [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch
@ 2024-08-06 12:10 Muhammad Usama Anjum
2024-08-06 16:00 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-08-06 12:10 UTC (permalink / raw)
To: Paolo Bonzini, Shuah Khan
Cc: Muhammad Usama Anjum, kernel, kvm, linux-kselftest, linux-kernel
The mkdir generates an error when kvm suite is build for non-supported
architecture such as arm. Fix it by ignoring the error from mkdir.
mkdir: missing operand
Try 'mkdir --help' for more information.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
tools/testing/selftests/kvm/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index 48d32c5aa3eb7..8ff46a0a8d1cd 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -317,7 +317,7 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
-$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
+$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))) > /dev/null 2>&1)
$(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] 5+ messages in thread
* Re: [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch
2024-08-06 12:10 [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch Muhammad Usama Anjum
@ 2024-08-06 16:00 ` Shuah Khan
2024-08-07 6:08 ` Muhammad Usama Anjum
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2024-08-06 16:00 UTC (permalink / raw)
To: Muhammad Usama Anjum, Paolo Bonzini, Shuah Khan
Cc: kernel, kvm, linux-kselftest, linux-kernel, Shuah Khan
On 8/6/24 06:10, Muhammad Usama Anjum wrote:
> The mkdir generates an error when kvm suite is build for non-supported
built
unsupported
> architecture such as arm. Fix it by ignoring the error from mkdir.
>
> mkdir: missing operand
> Try 'mkdir --help' for more information.
Simply suppressing the message isn't a good fix. Can you investigate
a bit more on why mkdir is failing and the architectures it is failing
on?
This change simply suppresses the error message and continues - Should
this error end the build process or not run mkdir to begin with by
checking why $(sort $(dir $(TEST_GEN_PROGS)))) results in an empty
string?
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> tools/testing/selftests/kvm/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index 48d32c5aa3eb7..8ff46a0a8d1cd 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -317,7 +317,7 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
> $(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
> $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
>
> -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
> +$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))) > /dev/null 2>&1)
> $(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS)
> $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
> $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch
2024-08-06 16:00 ` Shuah Khan
@ 2024-08-07 6:08 ` Muhammad Usama Anjum
2024-08-07 6:33 ` Muhammad Usama Anjum
0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-08-07 6:08 UTC (permalink / raw)
To: Paolo Bonzini, Shuah Khan
Cc: Usama.Anjum, kernel, kvm, linux-kselftest, linux-kernel,
Shuah Khan
On 8/6/24 9:00 PM, Shuah Khan wrote:
> On 8/6/24 06:10, Muhammad Usama Anjum wrote:
>> The mkdir generates an error when kvm suite is build for non-supported
>
> built
> unsupported
>
>> architecture such as arm. Fix it by ignoring the error from mkdir.
>>
>> mkdir: missing operand
>> Try 'mkdir --help' for more information.
>
> Simply suppressing the message isn't a good fix. Can you investigate
> a bit more on why mkdir is failing and the architectures it is failing
> on?
>
> This change simply suppresses the error message and continues - Should
> this error end the build process or not run mkdir to begin with by
> checking why $(sort $(dir $(TEST_GEN_PROGS)))) results in an empty
> string?
The tests are specified on per architecture basis. As KVM isn't supported on arm, there are no tests in TEST_GEN_PROGS and it is empty. While lib.mk infrastructure has support to ignore and not build anything in such cases, the Makefile's behaviour isn't robust enough.
I think the better fix would be to check if TEST_GEN_PROGS isn't empty and then call mkdir. I'll reiterate and send the fix.
>
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> tools/testing/selftests/kvm/Makefile | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
>> index 48d32c5aa3eb7..8ff46a0a8d1cd 100644
>> --- a/tools/testing/selftests/kvm/Makefile
>> +++ b/tools/testing/selftests/kvm/Makefile
>> @@ -317,7 +317,7 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
>> $(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
>> $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
>> -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
>> +$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))) > /dev/null 2>&1)
>> $(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS)
>> $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
>> $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
>
>
> thanks,
> -- Shuah
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch
2024-08-07 6:08 ` Muhammad Usama Anjum
@ 2024-08-07 6:33 ` Muhammad Usama Anjum
2024-08-08 12:13 ` Muhammad Usama Anjum
0 siblings, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-08-07 6:33 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Usama.Anjum, kernel, kvm, linux-kselftest, linux-kernel,
Shuah Khan, Shuah Khan
On 8/7/24 11:08 AM, Muhammad Usama Anjum wrote:
> On 8/6/24 9:00 PM, Shuah Khan wrote:
>> On 8/6/24 06:10, Muhammad Usama Anjum wrote:
>>> The mkdir generates an error when kvm suite is build for non-supported
>>
>> built
>> unsupported
>>
>>> architecture such as arm. Fix it by ignoring the error from mkdir.
>>>
>>> mkdir: missing operand
>>> Try 'mkdir --help' for more information.
>>
>> Simply suppressing the message isn't a good fix. Can you investigate
>> a bit more on why mkdir is failing and the architectures it is failing
>> on?
>>
>> This change simply suppresses the error message and continues - Should
>> this error end the build process or not run mkdir to begin with by
>> checking why $(sort $(dir $(TEST_GEN_PROGS)))) results in an empty
>> string?
> The tests are specified on per architecture basis. As KVM isn't supported on arm, there are no tests in TEST_GEN_PROGS and it is empty. While lib.mk infrastructure has support to ignore and not build anything in such cases, the Makefile's behaviour isn't robust enough.
>
> I think the better fix would be to check if TEST_GEN_PROGS isn't empty and then call mkdir. I'll reiterate and send the fix.
Waiting on Paolo's response before sending the following fix. Maybe he
has better idea here.
--- 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 $@
-$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
+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)
>
>>
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>> tools/testing/selftests/kvm/Makefile | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
>>> index 48d32c5aa3eb7..8ff46a0a8d1cd 100644
>>> --- a/tools/testing/selftests/kvm/Makefile
>>> +++ b/tools/testing/selftests/kvm/Makefile
>>> @@ -317,7 +317,7 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
>>> $(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
>>> $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
>>> -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
>>> +$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))) > /dev/null 2>&1)
>>> $(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS)
>>> $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
>>> $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
>>
>>
>> thanks,
>> -- Shuah
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch
2024-08-07 6:33 ` Muhammad Usama Anjum
@ 2024-08-08 12:13 ` Muhammad Usama Anjum
0 siblings, 0 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-08-08 12:13 UTC (permalink / raw)
To: Paolo Bonzini, Sean Christopherson
Cc: Usama.Anjum, kernel, kvm, linux-kselftest, linux-kernel,
Shuah Khan, Shuah Khan
Adding Sean
On 8/7/24 11:33 AM, Muhammad Usama Anjum wrote:
> On 8/7/24 11:08 AM, Muhammad Usama Anjum wrote:
>> On 8/6/24 9:00 PM, Shuah Khan wrote:
>>> On 8/6/24 06:10, Muhammad Usama Anjum wrote:
>>>> The mkdir generates an error when kvm suite is build for non-supported
>>>
>>> built
>>> unsupported
>>>
>>>> architecture such as arm. Fix it by ignoring the error from mkdir.
>>>>
>>>> mkdir: missing operand
>>>> Try 'mkdir --help' for more information.
>>>
>>> Simply suppressing the message isn't a good fix. Can you investigate
>>> a bit more on why mkdir is failing and the architectures it is failing
>>> on?
>>>
>>> This change simply suppresses the error message and continues - Should
>>> this error end the build process or not run mkdir to begin with by
>>> checking why $(sort $(dir $(TEST_GEN_PROGS)))) results in an empty
>>> string?
>> The tests are specified on per architecture basis. As KVM isn't supported on arm, there are no tests in TEST_GEN_PROGS and it is empty. While lib.mk infrastructure has support to ignore and not build anything in such cases, the Makefile's behaviour isn't robust enough.
>>
>> I think the better fix would be to check if TEST_GEN_PROGS isn't empty and then call mkdir. I'll reiterate and send the fix.
>
> Waiting on Paolo's response before sending the following fix. Maybe he
> has better idea here.
> --- 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 $@
>
> -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
> +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)
Do you agree with the fix or is there better fix? Please feel free to
jump in to propose better fix here.
>
>
>>
>>>
>>>>
>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>> ---
>>>> tools/testing/selftests/kvm/Makefile | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
>>>> index 48d32c5aa3eb7..8ff46a0a8d1cd 100644
>>>> --- a/tools/testing/selftests/kvm/Makefile
>>>> +++ b/tools/testing/selftests/kvm/Makefile
>>>> @@ -317,7 +317,7 @@ $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S $(GEN_HDRS)
>>>> $(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
>>>> $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
>>>> -$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
>>>> +$(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))) > /dev/null 2>&1)
>>>> $(SPLIT_TEST_GEN_OBJ): $(GEN_HDRS)
>>>> $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
>>>> $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
>>>
>>>
>>> thanks,
>>> -- Shuah
>>
>
--
BR,
Muhammad Usama Anjum
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-08 12:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 12:10 [PATCH] selftests: kvm: fix mkdir error when building for non-supported arch Muhammad Usama Anjum
2024-08-06 16:00 ` Shuah Khan
2024-08-07 6:08 ` Muhammad Usama Anjum
2024-08-07 6:33 ` Muhammad Usama Anjum
2024-08-08 12:13 ` 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