diff mbox series

[v2,4/4] Makefile: add headers to kselftest targets

Message ID 745d1921a4d048ea25d262e33b40aad5ee470614.1657614127.git.guillaume.tucker@collabora.com
State Superseded
Headers show
Series Fix kselftest build with sub-directory | expand

Commit Message

Guillaume Tucker July 12, 2022, 8:29 a.m. UTC
Add headers as a dependency to kselftest targets so that they can be
run directly from the top of the tree.  The kselftest Makefile used to
try to call headers_install "backwards" but failed due to the relative
path not being consistent.

Now we can either run this directly:

  $ make O=build kselftest-all

or this:

  $ make O=build headers
  $ make O=build -C tools/testing/selftests all

The same commands work as well when building directly in the source
tree (no O=) or any arbitrary path (relative or absolute).

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---

Notes:
    v2: replace headers_install with headers

 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Nicolas Schier July 13, 2022, 9:09 a.m. UTC | #1
On Tue, 12 Jul 2022 09:29 +0100 Guillaume Tucker wrote:
> Add headers as a dependency to kselftest targets so that they can be
> run directly from the top of the tree.  The kselftest Makefile used to
> try to call headers_install "backwards" but failed due to the relative
> path not being consistent.
> 
> Now we can either run this directly:
> 
>   $ make O=build kselftest-all
> 
> or this:
> 
>   $ make O=build headers
>   $ make O=build -C tools/testing/selftests all
> 
> The same commands work as well when building directly in the source
> tree (no O=) or any arbitrary path (relative or absolute).
> 
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---

You might want to add the 'Reported-by: as you did in 
https://lore.kernel.org/linux-kbuild/a7af58feaa6ae6d3b0c8c55972a470cec62341e5.1657693952.git.guillaume.tucker@collabora.com/ 
?

Tested-by: Nicolas Schier <nicolas@fjasle.eu>

> 
> Notes:
>     v2: replace headers_install with headers
> 
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 1a6678d817bd..02502cc4ced5 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1347,10 +1347,10 @@ tools/%: FORCE
>  # Kernel selftest
>  
>  PHONY += kselftest
> -kselftest:
> +kselftest: headers
>  	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
>  
> -kselftest-%: FORCE
> +kselftest-%: headers FORCE
>  	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
>  
>  PHONY += kselftest-merge
> -- 
> 2.30.2
Guillaume Tucker July 13, 2022, 1:04 p.m. UTC | #2
On 13/07/2022 11:09, Nicolas Schier wrote:
> On Tue, 12 Jul 2022 09:29 +0100 Guillaume Tucker wrote:
>> Add headers as a dependency to kselftest targets so that they can be
>> run directly from the top of the tree.  The kselftest Makefile used to
>> try to call headers_install "backwards" but failed due to the relative
>> path not being consistent.
>>
>> Now we can either run this directly:
>>
>>   $ make O=build kselftest-all
>>
>> or this:
>>
>>   $ make O=build headers
>>   $ make O=build -C tools/testing/selftests all
>>
>> The same commands work as well when building directly in the source
>> tree (no O=) or any arbitrary path (relative or absolute).
>>
>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
> You might want to add the 'Reported-by: as you did in 
> https://lore.kernel.org/linux-kbuild/a7af58feaa6ae6d3b0c8c55972a470cec62341e5.1657693952.git.guillaume.tucker@collabora.com/ 

Except I don't know who reported the issue, I think it was just
very well known.  KernelCI builds have been working around it for
a couple of years.

The Reported-by in the other patch was about using "headers"
rather than "headers_install", as a follow-up improvement on top
of this patch.

> Tested-by: Nicolas Schier <nicolas@fjasle.eu>

Thank you!

Guillaume
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 1a6678d817bd..02502cc4ced5 100644
--- a/Makefile
+++ b/Makefile
@@ -1347,10 +1347,10 @@  tools/%: FORCE
 # Kernel selftest
 
 PHONY += kselftest
-kselftest:
+kselftest: headers
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests run_tests
 
-kselftest-%: FORCE
+kselftest-%: headers FORCE
 	$(Q)$(MAKE) -C $(srctree)/tools/testing/selftests $*
 
 PHONY += kselftest-merge