kernelci.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] selftests: Fix build when $(O) points to a relative path
@ 2022-02-16 22:38 Usama
  2022-02-25 17:22 ` Usama
  0 siblings, 1 reply; 6+ messages in thread
From: Usama @ 2022-02-16 22:38 UTC (permalink / raw)
  To: Shuah Khan, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh
  Cc: Muhammad Usama Anjum, kernel, kernelci, linux-kselftest,
	linux-kernel, netdev, bpf

Build of bpf and tc-testing selftests fails when the relative path of
the build directory is specified.

make -C tools/testing/selftests O=build0
make[1]: Entering directory '/linux_mainline/tools/testing/selftests/bpf'
../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
make[1]: Entering directory '/linux_mainline/tools/testing/selftests/tc-testing'
../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.

Makefiles of bpf and tc-testing include scripts/Makefile.include file.
This file has sanity checking inside it which checks the output path.
The output path is not relative to the bpf or tc-testing. The sanity
check fails. Expand the output path to get rid of this error. The fix is
the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
when $(O) points to a relative path").

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes in V2:
Add more explaination to the commit message.
Support make install as well.
---
 tools/testing/selftests/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4eda7c7c15694..6a5c25fcc9cfc 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -178,6 +178,7 @@ all: khdr
 		BUILD_TARGET=$$BUILD/$$TARGET;			\
 		mkdir $$BUILD_TARGET  -p;			\
 		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET	\
+				O=$(abs_objtree)		\
 				$(if $(FORCE_TARGETS),|| exit);	\
 		ret=$$((ret * $$?));				\
 	done; exit $$ret;
@@ -185,7 +186,8 @@ all: khdr
 run_tests: all
 	@for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
-		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
+		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \
+				O=$(abs_objtree);		    \
 	done;
 
 hotplug:
@@ -236,6 +238,7 @@ ifdef INSTALL_PATH
 	for TARGET in $(TARGETS); do \
 		BUILD_TARGET=$$BUILD/$$TARGET;	\
 		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
+				O=$(abs_objtree)		\
 				$(if $(FORCE_TARGETS),|| exit);	\
 		ret=$$((ret * $$?));		\
 	done; exit $$ret;
-- 
2.30.2


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

* Re: [PATCH V2] selftests: Fix build when $(O) points to a relative path
  2022-02-16 22:38 [PATCH V2] selftests: Fix build when $(O) points to a relative path Usama
@ 2022-02-25 17:22 ` Usama
  2022-02-25 18:01   ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Usama @ 2022-02-25 17:22 UTC (permalink / raw)
  To: Shuah Khan, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh
  Cc: usama.anjum, kernel, kernelci, linux-kselftest, linux-kernel,
	netdev, bpf

Any thoughts about it?

On 2/17/22 3:38 AM, Muhammad Usama Anjum wrote:
> Build of bpf and tc-testing selftests fails when the relative path of
> the build directory is specified.
> 
> make -C tools/testing/selftests O=build0
> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/bpf'
> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/tc-testing'
> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
> 
> Makefiles of bpf and tc-testing include scripts/Makefile.include file.
> This file has sanity checking inside it which checks the output path.
> The output path is not relative to the bpf or tc-testing. The sanity
> check fails. Expand the output path to get rid of this error. The fix is
> the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
> when $(O) points to a relative path").
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes in V2:
> Add more explaination to the commit message.
> Support make install as well.
> ---
>  tools/testing/selftests/Makefile | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 4eda7c7c15694..6a5c25fcc9cfc 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -178,6 +178,7 @@ all: khdr
>  		BUILD_TARGET=$$BUILD/$$TARGET;			\
>  		mkdir $$BUILD_TARGET  -p;			\
>  		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET	\
> +				O=$(abs_objtree)		\
>  				$(if $(FORCE_TARGETS),|| exit);	\
>  		ret=$$((ret * $$?));				\
>  	done; exit $$ret;
> @@ -185,7 +186,8 @@ all: khdr
>  run_tests: all
>  	@for TARGET in $(TARGETS); do \
>  		BUILD_TARGET=$$BUILD/$$TARGET;	\
> -		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
> +		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \
> +				O=$(abs_objtree);		    \
>  	done;
>  
>  hotplug:
> @@ -236,6 +238,7 @@ ifdef INSTALL_PATH
>  	for TARGET in $(TARGETS); do \
>  		BUILD_TARGET=$$BUILD/$$TARGET;	\
>  		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
> +				O=$(abs_objtree)		\
>  				$(if $(FORCE_TARGETS),|| exit);	\
>  		ret=$$((ret * $$?));		\
>  	done; exit $$ret;

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

* Re: [PATCH V2] selftests: Fix build when $(O) points to a relative path
  2022-02-25 17:22 ` Usama
@ 2022-02-25 18:01   ` Shuah Khan
  2022-02-25 21:13     ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2022-02-25 18:01 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh
  Cc: kernel, kernelci, linux-kselftest, linux-kernel, netdev, bpf, Shuah Khan

On 2/25/22 10:22 AM, Muhammad Usama Anjum wrote:
> Any thoughts about it?
> 

No to post please.

> On 2/17/22 3:38 AM, Muhammad Usama Anjum wrote:
>> Build of bpf and tc-testing selftests fails when the relative path of
>> the build directory is specified.
>>
>> make -C tools/testing/selftests O=build0
>> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/bpf'
>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
>> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/tc-testing'
>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
>>
>> Makefiles of bpf and tc-testing include scripts/Makefile.include file.
>> This file has sanity checking inside it which checks the output path.
>> The output path is not relative to the bpf or tc-testing. The sanity
>> check fails. Expand the output path to get rid of this error. The fix is
>> the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
>> when $(O) points to a relative path").
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> Changes in V2:
>> Add more explaination to the commit message.
>> Support make install as well.

Looks god to me. I can pull this in for Linux 5.18-rc1

thanks,
-- Shuah

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

* Re: [PATCH V2] selftests: Fix build when $(O) points to a relative path
  2022-02-25 18:01   ` Shuah Khan
@ 2022-02-25 21:13     ` Shuah Khan
  2022-02-26  7:32       ` Usama
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2022-02-25 21:13 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh, Shuah Khan
  Cc: kernel, kernelci, linux-kselftest, linux-kernel, netdev, bpf

On 2/25/22 11:01 AM, Shuah Khan wrote:
> On 2/25/22 10:22 AM, Muhammad Usama Anjum wrote:
>> Any thoughts about it?
>>
> 
> No to post please.
> 
>> On 2/17/22 3:38 AM, Muhammad Usama Anjum wrote:
>>> Build of bpf and tc-testing selftests fails when the relative path of
>>> the build directory is specified.
>>>
>>> make -C tools/testing/selftests O=build0
>>> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/bpf'
>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
>>> make[1]: Entering directory '/linux_mainline/tools/testing/selftests/tc-testing'
>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.  Stop.
>>>
>>> Makefiles of bpf and tc-testing include scripts/Makefile.include file.
>>> This file has sanity checking inside it which checks the output path.
>>> The output path is not relative to the bpf or tc-testing. The sanity
>>> check fails. Expand the output path to get rid of this error. The fix is
>>> the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
>>> when $(O) points to a relative path").
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>> Changes in V2:
>>> Add more explaination to the commit message.
>>> Support make install as well.
> 

Does the same happen when you use make kselftest-all?

I am unable to reproduce what you are seeing?

thanks,
-- Shuah


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

* Re: [PATCH V2] selftests: Fix build when $(O) points to a relative path
  2022-02-25 21:13     ` Shuah Khan
@ 2022-02-26  7:32       ` Usama
  2022-03-03 22:19         ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Usama @ 2022-02-26  7:32 UTC (permalink / raw)
  To: Shuah Khan, Shuah Khan, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh
  Cc: usama.anjum, kernel, kernelci, linux-kselftest, linux-kernel,
	netdev, bpf

On 2/26/22 2:13 AM, Shuah Khan wrote:
> On 2/25/22 11:01 AM, Shuah Khan wrote:
>> On 2/25/22 10:22 AM, Muhammad Usama Anjum wrote:
>>> Any thoughts about it?
>>>
>>
>> No to post please.
>>
>>> On 2/17/22 3:38 AM, Muhammad Usama Anjum wrote:
>>>> Build of bpf and tc-testing selftests fails when the relative path of
>>>> the build directory is specified.
>>>>
>>>> make -C tools/testing/selftests O=build0
>>>> make[1]: Entering directory
>>>> '/linux_mainline/tools/testing/selftests/bpf'
>>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist. 
>>>> Stop.
>>>> make[1]: Entering directory
>>>> '/linux_mainline/tools/testing/selftests/tc-testing'
>>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist. 
>>>> Stop.
>>>>
>>>> Makefiles of bpf and tc-testing include scripts/Makefile.include file.
>>>> This file has sanity checking inside it which checks the output path.
>>>> The output path is not relative to the bpf or tc-testing. The sanity
>>>> check fails. Expand the output path to get rid of this error. The
>>>> fix is
>>>> the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
>>>> when $(O) points to a relative path").
>>>>
>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>> ---
>>>> Changes in V2:
>>>> Add more explaination to the commit message.
>>>> Support make install as well.
>>
> 
> Does the same happen when you use make kselftest-all?
No, this problem doesn't appear when using make kselftest-all.

As separate output directory build was broken in kernel's top most
Makefile i.e., make kselftest-all O=dir. (I've sent separate patch to
fix this:
https://lore.kernel.org/lkml/20220223191016.1658728-1-usama.anjum@collabora.com/)
So people must have been using kselftest's internal Makefile directly to
keep object files in separate directory i.e., make -C
tools/testing/selftests O=dir and in this way the build of these tests
(bpf, tc-testing) fail. This patch is fixing those build errors.

> 
> I am unable to reproduce what you are seeing?
make -C tools/testing/selftests O=dir should reproduce this problem.

> 
> thanks,
> -- Shuah
> 

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

* Re: [PATCH V2] selftests: Fix build when $(O) points to a relative path
  2022-02-26  7:32       ` Usama
@ 2022-03-03 22:19         ` Shuah Khan
  0 siblings, 0 replies; 6+ messages in thread
From: Shuah Khan @ 2022-03-03 22:19 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Shuah Khan, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Martin KaFai Lau, Song Liu,
	Yonghong Song, John Fastabend, KP Singh
  Cc: kernel, kernelci, linux-kselftest, linux-kernel, netdev, bpf, Shuah Khan

On 2/26/22 12:32 AM, Muhammad Usama Anjum wrote:
> On 2/26/22 2:13 AM, Shuah Khan wrote:
>> On 2/25/22 11:01 AM, Shuah Khan wrote:
>>> On 2/25/22 10:22 AM, Muhammad Usama Anjum wrote:
>>>> Any thoughts about it?
>>>>
>>>
>>> No to post please.
>>>
>>>> On 2/17/22 3:38 AM, Muhammad Usama Anjum wrote:
>>>>> Build of bpf and tc-testing selftests fails when the relative path of
>>>>> the build directory is specified.
>>>>>
>>>>> make -C tools/testing/selftests O=build0
>>>>> make[1]: Entering directory
>>>>> '/linux_mainline/tools/testing/selftests/bpf'
>>>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.
>>>>> Stop.
>>>>> make[1]: Entering directory
>>>>> '/linux_mainline/tools/testing/selftests/tc-testing'
>>>>> ../../../scripts/Makefile.include:4: *** O=build0 does not exist.
>>>>> Stop.
>>>>>
>>>>> Makefiles of bpf and tc-testing include scripts/Makefile.include file.
>>>>> This file has sanity checking inside it which checks the output path.
>>>>> The output path is not relative to the bpf or tc-testing. The sanity
>>>>> check fails. Expand the output path to get rid of this error. The
>>>>> fix is
>>>>> the same as mentioned in commit 150a27328b68 ("bpf, preload: Fix build
>>>>> when $(O) points to a relative path").
>>>>>
>>>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>>>> ---
>>>>> Changes in V2:
>>>>> Add more explaination to the commit message.
>>>>> Support make install as well.
>>>
>>
>> Does the same happen when you use make kselftest-all?
> No, this problem doesn't appear when using make kselftest-all.
> 
> As separate output directory build was broken in kernel's top most
> Makefile i.e., make kselftest-all O=dir. (I've sent separate patch to
> fix this:
> https://lore.kernel.org/lkml/20220223191016.1658728-1-usama.anjum@collabora.com/)
> So people must have been using kselftest's internal Makefile directly to
> keep object files in separate directory i.e., make -C
> tools/testing/selftests O=dir and in this way the build of these tests
> (bpf, tc-testing) fail. This patch is fixing those build errors.
> 
>>
>> I am unable to reproduce what you are seeing?
> make -C tools/testing/selftests O=dir should reproduce this problem.
> 

Applied to linux-kselftest next for Linux 5.18-rc1.

thanks,
-- Shuah

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

end of thread, other threads:[~2022-03-03 22:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 22:38 [PATCH V2] selftests: Fix build when $(O) points to a relative path Usama
2022-02-25 17:22 ` Usama
2022-02-25 18:01   ` Shuah Khan
2022-02-25 21:13     ` Shuah Khan
2022-02-26  7:32       ` Usama
2022-03-03 22:19         ` 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).