[31/34] selftests: iommu: Use installed kernel headers search path

Message ID 20230127135755.79929-32-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 installed kernel headers rather
than using kernel headers in include/uapi from the source kernel tree
kernel headers.

Remove bogus ../../../../include/ from the search path, because
kernel source headers are not needed by those user-space selftests, and
it causes issues because -I paths are searched before -isystem paths,
and conflicts for files appearing both in kernel sources and in uapi
headers with incompatible semantics (e.g. types.h).

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>
---
 tools/testing/selftests/iommu/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Shuah Khan Jan. 30, 2023, 5:01 p.m. UTC | #1
On 1/27/23 06:57, Mathieu Desnoyers wrote:
> Use $(KHDR_INCLUDES) as lookup path for installed kernel headers rather
> than using kernel headers in include/uapi from the source kernel tree
> kernel headers.
> 
> Remove bogus ../../../../include/ from the search path, because
> kernel source headers are not needed by those user-space selftests, and
> it causes issues because -I paths are searched before -isystem paths,
> and conflicts for files appearing both in kernel sources and in uapi
> headers with incompatible semantics (e.g. types.h).
> 
> 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>
> ---
>   tools/testing/selftests/iommu/Makefile | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/iommu/Makefile b/tools/testing/selftests/iommu/Makefile
> index 7cb74d26f141..32c5fdfd0eef 100644
> --- a/tools/testing/selftests/iommu/Makefile
> +++ b/tools/testing/selftests/iommu/Makefile
> @@ -1,7 +1,6 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   CFLAGS += -Wall -O2 -Wno-unused-function
> -CFLAGS += -I../../../../include/uapi/
> -CFLAGS += -I../../../../include/
> +CFLAGS += $(KHDR_INCLUDES)
>   
>   CFLAGS += -D_GNU_SOURCE
>   

Adding iommu test maintainers:

I plan to take this through kselftest unless there are conflicts.
In case there are conflicts and you want to take this through yours

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

thanks,
-- Shuah
  
Jason Gunthorpe Jan. 30, 2023, 5:05 p.m. UTC | #2
On Mon, Jan 30, 2023 at 10:01:23AM -0700, Shuah Khan wrote:
> On 1/27/23 06:57, Mathieu Desnoyers wrote:
> > Use $(KHDR_INCLUDES) as lookup path for installed kernel headers rather
> > than using kernel headers in include/uapi from the source kernel tree
> > kernel headers.
> > 
> > Remove bogus ../../../../include/ from the search path, because
> > kernel source headers are not needed by those user-space selftests, and
> > it causes issues because -I paths are searched before -isystem paths,
> > and conflicts for files appearing both in kernel sources and in uapi
> > headers with incompatible semantics (e.g. types.h).
> > 
> > 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>
> > ---
> >   tools/testing/selftests/iommu/Makefile | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/tools/testing/selftests/iommu/Makefile b/tools/testing/selftests/iommu/Makefile
> > index 7cb74d26f141..32c5fdfd0eef 100644
> > --- a/tools/testing/selftests/iommu/Makefile
> > +++ b/tools/testing/selftests/iommu/Makefile
> > @@ -1,7 +1,6 @@
> >   # SPDX-License-Identifier: GPL-2.0-only
> >   CFLAGS += -Wall -O2 -Wno-unused-function
> > -CFLAGS += -I../../../../include/uapi/
> > -CFLAGS += -I../../../../include/
> > +CFLAGS += $(KHDR_INCLUDES)
> >   CFLAGS += -D_GNU_SOURCE
> 
> Adding iommu test maintainers:
> 
> I plan to take this through kselftest unless there are conflicts.
> In case there are conflicts and you want to take this through yours
> 
> Acked-by: Shuah Khan <skhan@linuxfoundation.org>

Go ahead please

Jason
  

Patch

diff --git a/tools/testing/selftests/iommu/Makefile b/tools/testing/selftests/iommu/Makefile
index 7cb74d26f141..32c5fdfd0eef 100644
--- a/tools/testing/selftests/iommu/Makefile
+++ b/tools/testing/selftests/iommu/Makefile
@@ -1,7 +1,6 @@ 
 # SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -Wall -O2 -Wno-unused-function
-CFLAGS += -I../../../../include/uapi/
-CFLAGS += -I../../../../include/
+CFLAGS += $(KHDR_INCLUDES)
 
 CFLAGS += -D_GNU_SOURCE