diff mbox series

selftests: Fix build when $(O) points to a relative path

Message ID 20220204225817.3918648-1-usama.anjum@collabora.com (mailing list archive)
State New
Headers show
Series selftests: Fix build when $(O) points to a relative path | expand

Commit Message

Muhammad Usama Anjum Feb. 4, 2022, 10:58 p.m. UTC
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.

The fix is 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>
---
 tools/testing/selftests/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andrii Nakryiko Feb. 7, 2022, 7:22 p.m. UTC | #1
On Fri, Feb 4, 2022 at 2:59 PM Muhammad Usama Anjum
<usama.anjum@collabora.com> 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.
>
> The fix is same as mentioned in commit 150a27328b68 ("bpf, preload: Fix
> build when $(O) points to a relative path").
>

I don't think it actually helps building BPF selftest. Even with this
patch applied, all the feature detection doesn't work, and I get
reallocarray redefinition failure when bpftool is being built as part
of selftest.

> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>  tools/testing/selftests/Makefile | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 4eda7c7c15694..aa0faf132c35a 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:
> --
> 2.30.2
>
Muhammad Usama Anjum Feb. 7, 2022, 8:59 p.m. UTC | #2
On 2/8/22 12:22 AM, Andrii Nakryiko wrote:
> On Fri, Feb 4, 2022 at 2:59 PM Muhammad Usama Anjum
> <usama.anjum@collabora.com> 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.
>>
>> The fix is same as mentioned in commit 150a27328b68 ("bpf, preload: Fix
>> build when $(O) points to a relative path").
>>
> 
> I don't think it actually helps building BPF selftest. Even with this
This patch is fixing one type of build error which occurs if output
directory's path is relative.

> patch applied, all the feature detection doesn't work, and I get
> reallocarray redefinition failure when bpftool is being built as part
> of selftest.
There may be more problems in BPF tests. Those needs to be looked at
separately.

>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>>  tools/testing/selftests/Makefile | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
>> index 4eda7c7c15694..aa0faf132c35a 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:
>> --
>> 2.30.2
>>
diff mbox series

Patch

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4eda7c7c15694..aa0faf132c35a 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: