Skip to contentSkip to conversation

kselftest/arm64: Fix ABI header directory location

PATCH In review Mark Brown 2 participants 3 messages May 3, 2022 – May 4, 2022

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 kselftest/arm64: Fix ABI header directory location

Currently the arm64 kselftests attempt to locate the ABI headers using custom logic which doesn't work correctly in the case of out of tree builds if KBUILD_OUTPUT is not specified. Since lib.mk defines KHDR_INCLUDES with the appropriate flags we can simply remove the custom logic and use that instead.

---

This fix is required to get us able to run the arm64 kselftests in KernelCI, it does out of tree kselftest builds triggering the issue especially in conjunction with the addition of the new definitions for SME.

 tools/testing/selftests/arm64/Makefile | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
tools/testing/selftests/arm64/Makefile +1 -10
index 1e8d9a8f59df..9460cbe81bcc 100644
@@ -17,16 +17,7 @@ top_srcdir = $(realpath ../../../../)
 # Additional include paths needed by kselftest.h and local headers
 CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
 
-# Guessing where the Kernel headers could have been installed
-# depending on ENV config
-ifeq ($(KBUILD_OUTPUT),)
-khdr_dir = $(top_srcdir)/usr/include
-else
-# the KSFT preferred location when KBUILD_OUTPUT is set
-khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
-endif
-
-CFLAGS += -I$(khdr_dir)
+CFLAGS += $(KHDR_INCLUDES)
 
 export CFLAGS
 export top_srcdir
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 26 lines · Mark Brown

Currently the arm64 kselftests attempt to locate the ABI headers using custom logic which doesn't work correctly in the case of out of tree builds if KBUILD_OUTPUT is not specified. Since lib.mk defines KHDR_INCLUDES with the appropriate flags we can simply remove the custom logic and use that instead.

---

This fix is required to get us able to run the arm64 kselftests in KernelCI, it does out of tree kselftest builds triggering the issue especially in conjunction with the addition of the new definitions for SME.

 tools/testing/selftests/arm64/Makefile | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
tools/testing/selftests/arm64/Makefile +0 -1
index 1e8d9a8f59df..9460cbe81bcc 100644
@@ -17,16 +17,7 @@ top_srcdir = $(realpath ../../../../)
 # Additional include paths needed by kselftest.h and local headers
 CFLAGS += -I$(top_srcdir)/tools/testing/selftests/
 
-# Guessing where the Kernel headers could have been installed

tools/testing/selftests/arm64/Makefile top_srcdir = $(realpath ../../../../) · line 20

Quoted 10 lines
tools/testing/selftests/arm64/Makefile +1 -9
-# depending on ENV config
-ifeq ($(KBUILD_OUTPUT),)
-khdr_dir = $(top_srcdir)/usr/include
-else
-# the KSFT preferred location when KBUILD_OUTPUT is set
-khdr_dir = $(KBUILD_OUTPUT)/kselftest/usr/include
-endif
-
-CFLAGS += -I$(khdr_dir)
+CFLAGS += $(KHDR_INCLUDES)

Great, thanks. I had exactly the same diff stashed last week when testing the kselftest branch, just forgot about posting it. I'll apply yours.

Signature · 1 line
Catalin
maintainer
#2 lore raw
In reply to Mark Brown
Quoted 8 lines · Mark Brown

Currently the arm64 kselftests attempt to locate the ABI headers using custom logic which doesn't work correctly in the case of out of tree builds if KBUILD_OUTPUT is not specified. Since lib.mk defines KHDR_INCLUDES with the appropriate flags we can simply remove the custom logic and use that instead.

[...]

Applied to arm64 (for-next/kselftest), thanks!

[1/1] kselftest/arm64: Fix ABI header directory location

      https://git.kernel.org/arm64/c/ae60e0763e97
Signature · 1 line
Catalin