[21/34] selftests: powerpc: Fix incorrect kernel headers search path

Message ID 20230127135755.79929-22-mathieu.desnoyers@efficios.com
State New
Headers
Series selftests: Fix incorrect kernel headers search path |

Commit Message

Mathieu Desnoyers Jan. 27, 2023, 1:57 p.m. UTC
  Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
building against kernel headers from the build environment in scenarios
where kernel headers are installed into a specific output directory
(O=...).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-kselftest@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <stable@vger.kernel.org>    [5.18+]
---
 tools/testing/selftests/powerpc/ptrace/Makefile   | 2 +-
 tools/testing/selftests/powerpc/security/Makefile | 2 +-
 tools/testing/selftests/powerpc/syscalls/Makefile | 2 +-
 tools/testing/selftests/powerpc/tm/Makefile       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Shuah Khan Jan. 30, 2023, 4:32 p.m. UTC | #1
On 1/27/23 06:57, Mathieu Desnoyers wrote:
> Use $(KHDR_INCLUDES) as lookup path for kernel headers. This prevents
> building against kernel headers from the build environment in scenarios
> where kernel headers are installed into a specific output directory
> (O=...).
> 
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Cc: Shuah Khan <shuah@kernel.org>
> Cc: linux-kselftest@vger.kernel.org
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: <stable@vger.kernel.org>    [5.18+]
> ---
>   tools/testing/selftests/powerpc/ptrace/Makefile   | 2 +-
>   tools/testing/selftests/powerpc/security/Makefile | 2 +-
>   tools/testing/selftests/powerpc/syscalls/Makefile | 2 +-
>   tools/testing/selftests/powerpc/tm/Makefile       | 2 +-
>   4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
> index 2f02cb54224d..cbeeaeae8837 100644
> --- a/tools/testing/selftests/powerpc/ptrace/Makefile
> +++ b/tools/testing/selftests/powerpc/ptrace/Makefile
> @@ -33,7 +33,7 @@ TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64))
>   $(TESTS_64): CFLAGS += -m64
>   $(TM_TESTS): CFLAGS += -I../tm -mhtm
>   
> -CFLAGS += -I../../../../../usr/include -fno-pie
> +CFLAGS += $(KHDR_INCLUDES) -fno-pie
>   
>   $(OUTPUT)/ptrace-gpr: ptrace-gpr.S
>   $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
> diff --git a/tools/testing/selftests/powerpc/security/Makefile b/tools/testing/selftests/powerpc/security/Makefile
> index 7488315fd847..e0d979ab0204 100644
> --- a/tools/testing/selftests/powerpc/security/Makefile
> +++ b/tools/testing/selftests/powerpc/security/Makefile
> @@ -5,7 +5,7 @@ TEST_PROGS := mitigation-patching.sh
>   
>   top_srcdir = ../../../../..
>   
> -CFLAGS += -I../../../../../usr/include
> +CFLAGS += $(KHDR_INCLUDES)
>   
>   include ../../lib.mk
>   
> diff --git a/tools/testing/selftests/powerpc/syscalls/Makefile b/tools/testing/selftests/powerpc/syscalls/Makefile
> index b63f8459c704..d1f2648b112b 100644
> --- a/tools/testing/selftests/powerpc/syscalls/Makefile
> +++ b/tools/testing/selftests/powerpc/syscalls/Makefile
> @@ -1,7 +1,7 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   TEST_GEN_PROGS := ipc_unmuxed rtas_filter
>   
> -CFLAGS += -I../../../../../usr/include
> +CFLAGS += $(KHDR_INCLUDES)
>   
>   top_srcdir = ../../../../..
>   include ../../lib.mk
> diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile
> index 5881e97c73c1..3876805c2f31 100644
> --- a/tools/testing/selftests/powerpc/tm/Makefile
> +++ b/tools/testing/selftests/powerpc/tm/Makefile
> @@ -17,7 +17,7 @@ $(TEST_GEN_PROGS): ../harness.c ../utils.c
>   CFLAGS += -mhtm
>   
>   $(OUTPUT)/tm-syscall: tm-syscall-asm.S
> -$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
> +$(OUTPUT)/tm-syscall: CFLAGS += $(KHDR_INCLUDES)
>   $(OUTPUT)/tm-tmspr: CFLAGS += -pthread
>   $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
>   $(OUTPUT)/tm-resched-dscr: ../pmu/lib.c

Adding powerpc maitainers.

Would you me to take this patch through kselftest tree? If you
decide to take this through yours:

Acked-by: Shuah Khan <skhan@linuxfoundation.org>

thanks,
-- Shuah
  

Patch

diff --git a/tools/testing/selftests/powerpc/ptrace/Makefile b/tools/testing/selftests/powerpc/ptrace/Makefile
index 2f02cb54224d..cbeeaeae8837 100644
--- a/tools/testing/selftests/powerpc/ptrace/Makefile
+++ b/tools/testing/selftests/powerpc/ptrace/Makefile
@@ -33,7 +33,7 @@  TESTS_64 := $(patsubst %,$(OUTPUT)/%,$(TESTS_64))
 $(TESTS_64): CFLAGS += -m64
 $(TM_TESTS): CFLAGS += -I../tm -mhtm
 
-CFLAGS += -I../../../../../usr/include -fno-pie
+CFLAGS += $(KHDR_INCLUDES) -fno-pie
 
 $(OUTPUT)/ptrace-gpr: ptrace-gpr.S
 $(OUTPUT)/ptrace-pkey $(OUTPUT)/core-pkey: LDLIBS += -pthread
diff --git a/tools/testing/selftests/powerpc/security/Makefile b/tools/testing/selftests/powerpc/security/Makefile
index 7488315fd847..e0d979ab0204 100644
--- a/tools/testing/selftests/powerpc/security/Makefile
+++ b/tools/testing/selftests/powerpc/security/Makefile
@@ -5,7 +5,7 @@  TEST_PROGS := mitigation-patching.sh
 
 top_srcdir = ../../../../..
 
-CFLAGS += -I../../../../../usr/include
+CFLAGS += $(KHDR_INCLUDES)
 
 include ../../lib.mk
 
diff --git a/tools/testing/selftests/powerpc/syscalls/Makefile b/tools/testing/selftests/powerpc/syscalls/Makefile
index b63f8459c704..d1f2648b112b 100644
--- a/tools/testing/selftests/powerpc/syscalls/Makefile
+++ b/tools/testing/selftests/powerpc/syscalls/Makefile
@@ -1,7 +1,7 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
 TEST_GEN_PROGS := ipc_unmuxed rtas_filter
 
-CFLAGS += -I../../../../../usr/include
+CFLAGS += $(KHDR_INCLUDES)
 
 top_srcdir = ../../../../..
 include ../../lib.mk
diff --git a/tools/testing/selftests/powerpc/tm/Makefile b/tools/testing/selftests/powerpc/tm/Makefile
index 5881e97c73c1..3876805c2f31 100644
--- a/tools/testing/selftests/powerpc/tm/Makefile
+++ b/tools/testing/selftests/powerpc/tm/Makefile
@@ -17,7 +17,7 @@  $(TEST_GEN_PROGS): ../harness.c ../utils.c
 CFLAGS += -mhtm
 
 $(OUTPUT)/tm-syscall: tm-syscall-asm.S
-$(OUTPUT)/tm-syscall: CFLAGS += -I../../../../../usr/include
+$(OUTPUT)/tm-syscall: CFLAGS += $(KHDR_INCLUDES)
 $(OUTPUT)/tm-tmspr: CFLAGS += -pthread
 $(OUTPUT)/tm-vmx-unavail: CFLAGS += -pthread -m64
 $(OUTPUT)/tm-resched-dscr: ../pmu/lib.c