The patch titled Subject: selftests-error-out-if-kernel-header-files-are-not-yet-built-fix has been added to the -mm mm-unstable branch. Its filename is selftests-error-out-if-kernel-header-files-are-not-yet-built-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-error-out-if-kernel-header-files-are-not-yet-built-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: John Hubbard <jhubbard@xxxxxxxxxx> Subject: selftests-error-out-if-kernel-header-files-are-not-yet-built-fix Date: Tue, 6 Jun 2023 13:10:23 -0700 abort the make process the first time headers aren't detected Link: https://lkml.kernel.org/r/14573e7e-f2ad-ff34-dfbd-3efdebee51ed@xxxxxxxxxx Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Jonathan Corbet <corbet@xxxxxxx> Cc: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Nathan Chancellor <nathan@xxxxxxxxxx> Cc: Shuah Khan <shuah@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/Makefile | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) --- a/tools/testing/selftests/Makefile~selftests-error-out-if-kernel-header-files-are-not-yet-built-fix +++ a/tools/testing/selftests/Makefile @@ -145,10 +145,12 @@ ifneq ($(KBUILD_OUTPUT),) abs_objtree := $(realpath $(abs_objtree)) BUILD := $(abs_objtree)/kselftest KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include + KHDR_DIR := ${abs_objtree}/usr/include else BUILD := $(CURDIR) abs_srctree := $(shell cd $(top_srcdir) && pwd) KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include + KHDR_DIR := ${abs_srctree}/usr/include DEFAULT_INSTALL_HDR_PATH := 1 endif @@ -162,7 +164,7 @@ export KHDR_INCLUDES # all isn't the first target in the file. .DEFAULT_GOAL := all -all: +all: kernel_header_files @ret=1; \ for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ @@ -173,6 +175,23 @@ all: ret=$$((ret * $$?)); \ done; exit $$ret; +kernel_header_files: + @ls $(KHDR_DIR)/linux/*.h >/dev/null 2>/dev/null; \ + if [ $$? -ne 0 ]; then \ + RED='\033[1;31m'; \ + NOCOLOR='\033[0m'; \ + echo; \ + echo -e "$${RED}error$${NOCOLOR}: missing kernel header files."; \ + echo "Please run this and try again:"; \ + echo; \ + echo " cd $(top_srcdir)"; \ + echo " make headers"; \ + echo; \ + exit 1; \ + fi + +.PHONY: kernel_header_files + run_tests: all @for TARGET in $(TARGETS); do \ BUILD_TARGET=$$BUILD/$$TARGET; \ _ Patches currently in -mm which might be from jhubbard@xxxxxxxxxx are selftests-mm-fix-uffd-stress-unused-function-warning.patch selftests-mm-fix-unused-variable-warnings-in-hugetlb-madvisec-migrationc.patch selftests-mm-fix-warning-expression-which-evaluates-to-zero-in-mlock2-testsc.patch selftests-mm-fix-invocation-of-tests-that-are-run-via-shell-scripts.patch selftests-mm-gitignore-add-mkdirty-va_high_addr_switch.patch selftests-mm-fix-two-wformat-security-warnings-in-uffd-builds.patch selftests-mm-fix-a-possibly-uninitialized-warning-in-pkey-x86h.patch selftests-mm-fix-build-failures-due-to-missing-madv_collapse.patch selftests-mm-move-certain-uffd-routines-from-vm_utilc-to-uffd-commonc.patch documentation-kselftest-make-headers-is-a-prerequisite.patch selftests-error-out-if-kernel-header-files-are-not-yet-built.patch selftests-error-out-if-kernel-header-files-are-not-yet-built-fix.patch