linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests: Fix O= and KBUILD_OUTPUT handling for relative paths
@ 2019-10-15  1:45 Shuah Khan
  2019-10-15 23:27 ` Tim.Bird
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2019-10-15  1:45 UTC (permalink / raw)
  To: shuah; +Cc: Shuah Khan, linux-kselftest, linux-kernel, Tim Bird

Fix O= and KBUILD_OUTPUT handling for relative paths.

export KBUILD_OUTPUT=../kselftest_size
make TARGETS=size kselftest-all

or

make O=../kselftest_size TARGETS=size kselftest-all

In both of these cases, targets get built in ../kselftest_size which is
a one level up from the size test directory.

make[1]: Entering directory '/mnt/data/lkml/kselftest_size'
make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
        ARCH=x86 -C ../../.. headers_install
  INSTALL ../kselftest_size/usr/include
gcc -static -ffreestanding -nostartfiles -s    get_size.c  -o ../kselftest_size/size/get_size
/usr/bin/ld: cannot open output file ../kselftest_size/size/get_size: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [../lib.mk:138: ../kselftest_size/size/get_size] Error 1
make[2]: *** [Makefile:143: all] Error 2
make[1]: *** [/mnt/data/lkml/linux_5.4/Makefile:1221: kselftest-all] Error 2
make[1]: Leaving directory '/mnt/data/lkml/kselftest_size'
make: *** [Makefile:179: sub-make] Error 2

Use abs_objtree exported by the main Makefile.

Reported-by: Tim Bird <Tim.Bird@sony.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4cdbae6f4e61..3405aa26a655 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -86,10 +86,10 @@ override LDFLAGS =
 endif
 
 ifneq ($(O),)
-	BUILD := $(O)
+	BUILD := $(abs_objtree)
 else
 	ifneq ($(KBUILD_OUTPUT),)
-		BUILD := $(KBUILD_OUTPUT)/kselftest
+		BUILD := $(abs_objtree)/kselftest
 	else
 		BUILD := $(shell pwd)
 		DEFAULT_INSTALL_HDR_PATH := 1
@@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include
 ARCH           ?= $(SUBARCH)
 export KSFT_KHDR_INSTALL_DONE := 1
 export BUILD
+#$(info abd_objtree = $(abs_objtree) BUILD = $(BUILD))
 
 # build and run gpio when output directory is the src dir.
 # gpio has dependency on tools/gpio and builds tools/gpio
-- 
2.20.1


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

* RE: [PATCH] selftests: Fix O= and KBUILD_OUTPUT handling for relative paths
  2019-10-15  1:45 [PATCH] selftests: Fix O= and KBUILD_OUTPUT handling for relative paths Shuah Khan
@ 2019-10-15 23:27 ` Tim.Bird
  2019-10-16  0:34   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Tim.Bird @ 2019-10-15 23:27 UTC (permalink / raw)
  To: skhan, shuah; +Cc: linux-kselftest, linux-kernel

> -----Original Message-----
> From: Shuah Khan on  Monday, October 14, 2019 3:45 PM
> 
> Fix O= and KBUILD_OUTPUT handling for relative paths.
> 
> export KBUILD_OUTPUT=../kselftest_size
> make TARGETS=size kselftest-all
> 
> or
> 
> make O=../kselftest_size TARGETS=size kselftest-all
> 
> In both of these cases, targets get built in ../kselftest_size which is
> a one level up from the size test directory.
> 
> make[1]: Entering directory '/mnt/data/lkml/kselftest_size'
> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>         ARCH=x86 -C ../../.. headers_install
>   INSTALL ../kselftest_size/usr/include
> gcc -static -ffreestanding -nostartfiles -s    get_size.c  -o
> ../kselftest_size/size/get_size
> /usr/bin/ld: cannot open output file ../kselftest_size/size/get_size: No such
> file or directory
> collect2: error: ld returned 1 exit status
> make[3]: *** [../lib.mk:138: ../kselftest_size/size/get_size] Error 1
> make[2]: *** [Makefile:143: all] Error 2
> make[1]: *** [/mnt/data/lkml/linux_5.4/Makefile:1221: kselftest-all] Error 2
> make[1]: Leaving directory '/mnt/data/lkml/kselftest_size'
> make: *** [Makefile:179: sub-make] Error 2
> 
> Use abs_objtree exported by the main Makefile.
> 
> Reported-by: Tim Bird <Tim.Bird@sony.com>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> ---
>  tools/testing/selftests/Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/Makefile
> b/tools/testing/selftests/Makefile
> index 4cdbae6f4e61..3405aa26a655 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -86,10 +86,10 @@ override LDFLAGS =
>  endif
> 
>  ifneq ($(O),)
> -	BUILD := $(O)
> +	BUILD := $(abs_objtree)
>  else
>  	ifneq ($(KBUILD_OUTPUT),)
> -		BUILD := $(KBUILD_OUTPUT)/kselftest
> +		BUILD := $(abs_objtree)/kselftest
>  	else
>  		BUILD := $(shell pwd)
>  		DEFAULT_INSTALL_HDR_PATH := 1
> @@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include
>  ARCH           ?= $(SUBARCH)
>  export KSFT_KHDR_INSTALL_DONE := 1
>  export BUILD
> +#$(info abd_objtree = $(abs_objtree) BUILD = $(BUILD))
> 
>  # build and run gpio when output directory is the src dir.
>  # gpio has dependency on tools/gpio and builds tools/gpio
> --

 This works great.  Thanks very much.

Tested-by: Tim Bird <tim.bird@sony.com>
Acked-by: Tim Bird <tim.bird@sony.com>

 -- Tim


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

* Re: [PATCH] selftests: Fix O= and KBUILD_OUTPUT handling for relative paths
  2019-10-15 23:27 ` Tim.Bird
@ 2019-10-16  0:34   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2019-10-16  0:34 UTC (permalink / raw)
  To: Tim.Bird, shuah; +Cc: linux-kselftest, linux-kernel, skha >> Shuah Khan

On 10/15/19 5:27 PM, Tim.Bird@sony.com wrote:
>> -----Original Message-----
>> From: Shuah Khan on  Monday, October 14, 2019 3:45 PM
>>
>> Fix O= and KBUILD_OUTPUT handling for relative paths.
>>
>> export KBUILD_OUTPUT=../kselftest_size
>> make TARGETS=size kselftest-all
>>
>> or
>>
>> make O=../kselftest_size TARGETS=size kselftest-all
>>
>> In both of these cases, targets get built in ../kselftest_size which is
>> a one level up from the size test directory.
>>
>> make[1]: Entering directory '/mnt/data/lkml/kselftest_size'
>> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>>          ARCH=x86 -C ../../.. headers_install
>>    INSTALL ../kselftest_size/usr/include
>> gcc -static -ffreestanding -nostartfiles -s    get_size.c  -o
>> ../kselftest_size/size/get_size
>> /usr/bin/ld: cannot open output file ../kselftest_size/size/get_size: No such
>> file or directory
>> collect2: error: ld returned 1 exit status
>> make[3]: *** [../lib.mk:138: ../kselftest_size/size/get_size] Error 1
>> make[2]: *** [Makefile:143: all] Error 2
>> make[1]: *** [/mnt/data/lkml/linux_5.4/Makefile:1221: kselftest-all] Error 2
>> make[1]: Leaving directory '/mnt/data/lkml/kselftest_size'
>> make: *** [Makefile:179: sub-make] Error 2
>>
>> Use abs_objtree exported by the main Makefile.
>>
>> Reported-by: Tim Bird <Tim.Bird@sony.com>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>> ---
>>   tools/testing/selftests/Makefile | 5 +++--
>>   1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/testing/selftests/Makefile
>> b/tools/testing/selftests/Makefile
>> index 4cdbae6f4e61..3405aa26a655 100644
>> --- a/tools/testing/selftests/Makefile
>> +++ b/tools/testing/selftests/Makefile
>> @@ -86,10 +86,10 @@ override LDFLAGS =
>>   endif
>>
>>   ifneq ($(O),)
>> -	BUILD := $(O)
>> +	BUILD := $(abs_objtree)
>>   else
>>   	ifneq ($(KBUILD_OUTPUT),)
>> -		BUILD := $(KBUILD_OUTPUT)/kselftest
>> +		BUILD := $(abs_objtree)/kselftest
>>   	else
>>   		BUILD := $(shell pwd)
>>   		DEFAULT_INSTALL_HDR_PATH := 1
>> @@ -102,6 +102,7 @@ include $(top_srcdir)/scripts/subarch.include
>>   ARCH           ?= $(SUBARCH)
>>   export KSFT_KHDR_INSTALL_DONE := 1
>>   export BUILD
>> +#$(info abd_objtree = $(abs_objtree) BUILD = $(BUILD))
>>
>>   # build and run gpio when output directory is the src dir.
>>   # gpio has dependency on tools/gpio and builds tools/gpio
>> --
> 
>   This works great.  Thanks very much.
> 
> Tested-by: Tim Bird <tim.bird@sony.com>
> Acked-by: Tim Bird <tim.bird@sony.com>
> 
>   -- Tim
> 
Thanks for testing. Will get this into 5.4-rc4

thanks,
-- SHuah

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

end of thread, other threads:[~2019-10-16  0:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  1:45 [PATCH] selftests: Fix O= and KBUILD_OUTPUT handling for relative paths Shuah Khan
2019-10-15 23:27 ` Tim.Bird
2019-10-16  0:34   ` Shuah Khan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).