diff mbox series

[1/2] kvm: selftests: Fix no directory error when OUTPUT specified

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

Commit Message

Xiaoyao Li March 15, 2020, 9:34 a.m. UTC
When build kvm selftests to an specified directory with

	make OUTPUT=~/kvm-selftests

it encouters following error:

/usr/bin/ld: cannot open output file
/home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or
directory
collect2: error: ld returned 1 exit status
make: *** [../lib.mk:141:
/home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 tools/testing/selftests/kvm/Makefile | 1 +
 1 file changed, 1 insertion(+)

Comments

shuah March 23, 2020, 3:40 p.m. UTC | #1
On 3/15/20 3:34 AM, Xiaoyao Li wrote:
> When build kvm selftests to an specified directory with
> 
> 	make OUTPUT=~/kvm-selftests
> 
> it encouters following error:

btw lib.mk can't handle relative paths yet. The problems
you are seeing are related to that as well. This relative
path issue should be fixed in lib.mk and not in individual
tests.

> 
> /usr/bin/ld: cannot open output file
> /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or
> directory
> collect2: error: ld returned 1 exit status
> make: *** [../lib.mk:141:
> /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1
> 
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> ---
>   tools/testing/selftests/kvm/Makefile | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
> index d91c53b726e6..86797e0242d4 100644
> --- a/tools/testing/selftests/kvm/Makefile
> +++ b/tools/testing/selftests/kvm/Makefile
> @@ -66,6 +66,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
>   # After inclusion, $(OUTPUT) is defined and
>   # $(TEST_GEN_PROGS) starts with $(OUTPUT)/
>   include ../lib.mk
> +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))

lib.mk would have created the directory.

thanks,
-- Shuah
Xiaoyao Li March 24, 2020, 1:51 a.m. UTC | #2
On 3/23/2020 11:40 PM, shuah wrote:
> On 3/15/20 3:34 AM, Xiaoyao Li wrote:
>> When build kvm selftests to an specified directory with
>>
>>     make OUTPUT=~/kvm-selftests
>>
>> it encouters following error:
> 
> btw lib.mk can't handle relative paths yet. The problems
> you are seeing are related to that as well.

I tried with absolute path as well. It didn't work.

> This relative
> path issue should be fixed in lib.mk and not in individual
> tests.

OK. I'll try to fix it in lib.mk

>>
>> /usr/bin/ld: cannot open output file
>> /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test: No such file or
>> directory
>> collect2: error: ld returned 1 exit status
>> make: *** [../lib.mk:141:
>> /home/lxy/kvm-selftests/x86_64/cr4_cpuid_sync_test] Error 1
>>
>> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>> ---
>>   tools/testing/selftests/kvm/Makefile | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/tools/testing/selftests/kvm/Makefile 
>> b/tools/testing/selftests/kvm/Makefile
>> index d91c53b726e6..86797e0242d4 100644
>> --- a/tools/testing/selftests/kvm/Makefile
>> +++ b/tools/testing/selftests/kvm/Makefile
>> @@ -66,6 +66,7 @@ LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
>>   # After inclusion, $(OUTPUT) is defined and
>>   # $(TEST_GEN_PROGS) starts with $(OUTPUT)/
>>   include ../lib.mk
>> +x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
> 
> lib.mk would have created the directory.
> 
> thanks,
> -- Shuah
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index d91c53b726e6..86797e0242d4 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -66,6 +66,7 @@  LDFLAGS += -pthread $(no-pie-option) $(pgste-option)
 # After inclusion, $(OUTPUT) is defined and
 # $(TEST_GEN_PROGS) starts with $(OUTPUT)/
 include ../lib.mk
+x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
 
 STATIC_LIBS := $(OUTPUT)/libkvm.a
 LIBKVM_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM))