diff mbox series

[1/4] selftests: Fix kselftest O=objdir build from cluttering top level objdir

Message ID 58d954867391c90fe0792d87e09a82bda26ba4fc.1583358715.git.skhan@linuxfoundation.org (mailing list archive)
State New
Headers show
Series Kselftest integration into Kernel CI - Part 1 | expand

Commit Message

Shuah Khan March 4, 2020, 10:13 p.m. UTC
make kselftest-all O=objdir builds create generated objects in objdir.
This clutters the top level directory with kselftest objects. Fix it
to create sub-directory under objdir for kselftest objects.

Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
---
 tools/testing/selftests/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kevin Hilman March 11, 2020, 10:58 p.m. UTC | #1
Shuah Khan <skhan@linuxfoundation.org> writes:

> make kselftest-all O=objdir builds create generated objects in objdir.
> This clutters the top level directory with kselftest objects. Fix it
> to create sub-directory under objdir for kselftest objects.
>
> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

Only somewhat related to this patch, another problem that wasn't in your
doci is that the current O= support doesn't support relative paths.

For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
Try this:

$ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
$ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
make[1]: Entering directory '/work/kernel/linux/build-arm64'
make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
	ARCH=arm64 -C ../../.. headers_install
make[4]: ../scripts/Makefile.build: No such file or directory
make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
Makefile:500: recipe for target 'scripts_basic' failed
make[3]: *** [scripts_basic] Error 2
Makefile:151: recipe for target 'khdr' failed
make[2]: *** [khdr] Error 2
/work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
make[1]: *** [kselftest-all] Error 2
make[1]: Leaving directory '/work/kernel/linux/build-arm64'
Makefile:179: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2  

Kevin

> ---
>  tools/testing/selftests/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 6ec503912bea..cd77df3e6bb8 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -91,7 +91,7 @@ override LDFLAGS =
>  override MAKEFLAGS =
>  endif
>  
> -# Append kselftest to KBUILD_OUTPUT to avoid cluttering
> +# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
>  # KBUILD_OUTPUT with selftest objects and headers installed
>  # by selftests Makefile or lib.mk.
>  ifdef building_out_of_srctree
> @@ -99,7 +99,7 @@ override LDFLAGS =
>  endif
>  
>  ifneq ($(O),)
> -	BUILD := $(O)
> +	BUILD := $(O)/kselftest
>  else
>  	ifneq ($(KBUILD_OUTPUT),)
>  		BUILD := $(KBUILD_OUTPUT)/kselftest
> -- 
> 2.20.1
Shuah Khan March 11, 2020, 11:31 p.m. UTC | #2
On 3/11/20 4:58 PM, Kevin Hilman wrote:
> Shuah Khan <skhan@linuxfoundation.org> writes:
> 
>> make kselftest-all O=objdir builds create generated objects in objdir.
>> This clutters the top level directory with kselftest objects. Fix it
>> to create sub-directory under objdir for kselftest objects.
>>
>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
> 
> Only somewhat related to this patch, another problem that wasn't in your
> doci is that the current O= support doesn't support relative paths.
> 

Yes I am aware of it and it is in the document as something that will
be addressed later.

"Note: Relative paths don’t work - supporting relative paths breaks 
work-flows e.g:
powerpc. Explore fix. Compile work-flows. Not planning to support at the 
moment."

> For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
> Try this:
> 
> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
> make[1]: Entering directory '/work/kernel/linux/build-arm64'
> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
> 	ARCH=arm64 -C ../../.. headers_install
> make[4]: ../scripts/Makefile.build: No such file or directory
> make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
> Makefile:500: recipe for target 'scripts_basic' failed
> make[3]: *** [scripts_basic] Error 2
> Makefile:151: recipe for target 'khdr' failed
> make[2]: *** [khdr] Error 2
> /work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
> make[1]: *** [kselftest-all] Error 2
> make[1]: Leaving directory '/work/kernel/linux/build-arm64'
> Makefile:179: recipe for target 'sub-make' failed
> make: *** [sub-make] Error 2
> 

I am looking to address build and install issues first.

thanks,
-- Shuah
Randy Dunlap May 15, 2020, 2:27 a.m. UTC | #3
On 3/11/20 4:31 PM, Shuah Khan wrote:
> On 3/11/20 4:58 PM, Kevin Hilman wrote:
>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>
>>> make kselftest-all O=objdir builds create generated objects in objdir.
>>> This clutters the top level directory with kselftest objects. Fix it
>>> to create sub-directory under objdir for kselftest objects.
>>>
>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>
>> Only somewhat related to this patch, another problem that wasn't in your
>> doci is that the current O= support doesn't support relative paths.
>>
> 
> Yes I am aware of it and it is in the document as something that will
> be addressed later.
> 
> "Note: Relative paths don’t work - supporting relative paths breaks work-flows e.g:
> powerpc. Explore fix. Compile work-flows. Not planning to support at the moment."

Hi,
Sorry to be dense but where is this documented (as quoted above)?

Thanks.

>> For example, using O=/tmp/build-arm64 works, but O=build-arm64 doesn't.
>> Try this:
>>
>> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 defconfig
>> $ make ARCH=arm64 HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu- O=build-arm64 kselftest-all
>> make[1]: Entering directory '/work/kernel/linux/build-arm64'
>> make --no-builtin-rules INSTALL_HDR_PATH=$BUILD/usr \
>>     ARCH=arm64 -C ../../.. headers_install
>> make[4]: ../scripts/Makefile.build: No such file or directory
>> make[4]: *** No rule to make target '../scripts/Makefile.build'.  Stop.
>> Makefile:500: recipe for target 'scripts_basic' failed
>> make[3]: *** [scripts_basic] Error 2
>> Makefile:151: recipe for target 'khdr' failed
>> make[2]: *** [khdr] Error 2
>> /work/kernel/linux/Makefile:1220: recipe for target 'kselftest-all' failed
>> make[1]: *** [kselftest-all] Error 2
>> make[1]: Leaving directory '/work/kernel/linux/build-arm64'
>> Makefile:179: recipe for target 'sub-make' failed
>> make: *** [sub-make] Error 2
>>
> 
> I am looking to address build and install issues first.
> 
> thanks,
> -- Shuah
Shuah Khan May 15, 2020, 2:15 p.m. UTC | #4
On 5/14/20 8:27 PM, Randy Dunlap wrote:
> On 3/11/20 4:31 PM, Shuah Khan wrote:
>> On 3/11/20 4:58 PM, Kevin Hilman wrote:
>>> Shuah Khan <skhan@linuxfoundation.org> writes:
>>>
>>>> make kselftest-all O=objdir builds create generated objects in objdir.
>>>> This clutters the top level directory with kselftest objects. Fix it
>>>> to create sub-directory under objdir for kselftest objects.
>>>>
>>>> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
>>>
>>> Only somewhat related to this patch, another problem that wasn't in your
>>> doci is that the current O= support doesn't support relative paths.
>>>
>>
>> Yes I am aware of it and it is in the document as something that will
>> be addressed later.
>>
>> "Note: Relative paths don’t work - supporting relative paths breaks work-flows e.g:
>> powerpc. Explore fix. Compile work-flows. Not planning to support at the moment."
> 

I attempted to fix it once and had to revert the patch. This relative
problem needs to be fixed and being tracked as a bug.

>>
>> I am looking to address build and install issues first.
>>

As I said above, there were higher priority test build and install
failures in cross-build and native build use-cases when I made this
call to prioritize fixing them first. I fixed all the known issues.

As of Linux 5.7-rc5 all of the know issues related test build and
install failures have been fixed.

With tha done, it is time to work on the relative path fix. I have
my reverted patch to start with and get it to work with the
workflows so it doesn't break them.

I also have the following patch you gave me as reference for fixing
the relative path problem:

https://lore.kernel.org/lkml/158351957799.3363.15269768530697526765.stgit@devnote2/

In any case, based on my previous experience fixing this problem,
I plan to take the fix in rc1 to allow enough time to fix any
problems that show up. It will be fixed for sure.

Hope this helps addresses any concerns you may have on whether or
not this problem will be fixed.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 6ec503912bea..cd77df3e6bb8 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -91,7 +91,7 @@  override LDFLAGS =
 override MAKEFLAGS =
 endif
 
-# Append kselftest to KBUILD_OUTPUT to avoid cluttering
+# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
 # KBUILD_OUTPUT with selftest objects and headers installed
 # by selftests Makefile or lib.mk.
 ifdef building_out_of_srctree
@@ -99,7 +99,7 @@  override LDFLAGS =
 endif
 
 ifneq ($(O),)
-	BUILD := $(O)
+	BUILD := $(O)/kselftest
 else
 	ifneq ($(KBUILD_OUTPUT),)
 		BUILD := $(KBUILD_OUTPUT)/kselftest