summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/lib.mk
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-05-14 21:36:54 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2024-05-14 21:36:54 +0300
commit4b95dc87362aa57bdd0dcbad109ca5e5ef3cbb6c (patch)
tree08067e68292d39b1820882e54dd7ff0319538adf /tools/testing/selftests/lib.mk
parent896d3fce84e7798520eb11b0e53abdcfb47b21be (diff)
parent2c3b8f8f37c6c0c926d584cf4158db95e62b960c (diff)
downloadlinux-4b95dc87362aa57bdd0dcbad109ca5e5ef3cbb6c.tar.xz
Merge tag 'linux_kselftest-next-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest updates from Shuah Khan: - make framework and tests reporting KTAP compliant - make ktap_helpers and power_supply test POSIX compliant - add ksft_exit_fail_perror() to include errono in string form - avoid clang reporting false positive static analysis errors about functions that exit and never return. ksft_exit* functions are marked __noreturn to address this problem - add mechanism for reporting a KSFT_ result code - fix build warnings related missing headers and unused variables - fix clang build failures - cleanups to resctrl test - add host arch for LLVM builds * tag 'linux_kselftest-next-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (44 commits) selftests/sgx: Include KHDR_INCLUDES in Makefile selftests: Compile kselftest headers with -D_GNU_SOURCE selftests/resctrl: fix clang build warnings related to abs(), labs() calls selftests/ftrace: Fix checkbashisms errors selftests/ftrace: Fix BTFARG testcase to check fprobe is enabled correctly selftests/capabilities: fix warn_unused_result build warnings selftests: filesystems: add missing stddef header selftests: kselftest_deps: fix l5_test() empty variable selftests: default to host arch for LLVM builds selftests/resctrl: fix clang build failure: use LOCAL_HDRS selftests/binderfs: use the Makefile's rules, not Make's implicit rules Documentation: kselftest: fix codeblock selftests: kselftest: Make ksft_exit functions return void instead of int selftests: x86: ksft_exit_pass() does not return selftests: timers: ksft_exit functions do not return selftests: sync: ksft_exit_pass() does not return selftests/resctrl: ksft_exit_skip() does not return selftests: pidfd: ksft_exit functions do not return selftests/mm: ksft_exit functions do not return selftests: membarrier: ksft_exit_pass() does not return ...
Diffstat (limited to 'tools/testing/selftests/lib.mk')
-rw-r--r--tools/testing/selftests/lib.mk14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/testing/selftests/lib.mk b/tools/testing/selftests/lib.mk
index da2cade3bab0..7fa4a96e26ed 100644
--- a/tools/testing/selftests/lib.mk
+++ b/tools/testing/selftests/lib.mk
@@ -7,6 +7,8 @@ else ifneq ($(filter -%,$(LLVM)),)
LLVM_SUFFIX := $(LLVM)
endif
+CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX)
+
CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi
CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu
CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl
@@ -18,7 +20,13 @@ CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu
CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu
CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu
CLANG_TARGET_FLAGS_x86_64 := x86_64-linux-gnu
-CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH))
+
+# Default to host architecture if ARCH is not explicitly given.
+ifeq ($(ARCH),)
+CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple)
+else
+CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH))
+endif
ifeq ($(CROSS_COMPILE),)
ifeq ($(CLANG_TARGET_FLAGS),)
@@ -30,7 +38,7 @@ else
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
endif # CROSS_COMPILE
-CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as
+CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
else
CC := $(CROSS_COMPILE)gcc
endif # LLVM
@@ -45,7 +53,7 @@ selfdir = $(realpath $(dir $(filter %/lib.mk,$(MAKEFILE_LIST))))
top_srcdir = $(selfdir)/../../..
ifeq ($(KHDR_INCLUDES),)
-KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
+KHDR_INCLUDES := -D_GNU_SOURCE -isystem $(top_srcdir)/usr/include
endif
# The following are built by lib.mk common compile rules.