Skip to content

Commit e076eac

Browse files
johnhubbardakpm00
authored andcommitted
selftests: break the dependency upon local header files
Patch series "Fix selftests/mm build without requiring "make headers"". As mentioned in each patch, this implements the solution that we discussed in December 2023, in [1]. This turned out to be very clean and easy. It should also be quite easy to maintain. This should also make Peter Zijlstra happy, because it directly addresses the root cause of his "NAK NAK NAK" reply [2]. :) [1] https://lore.kernel.org/all/[email protected]/ [2] https://lore.kernel.org/lkml/[email protected]/ This patch (of 2): Use tools/include/uapi/ files instead. These are obtained by taking a snapshot: run "make headers" at the top level, then copy the desired header file into the appropriate subdir in tools/uapi/. This was discussed and solved in [1]. However, even before copying any additional files there, there are already quite a few in tools/include/uapi already. And these will immediately fix a number of selftests/mm build failures. So this patch: a) Adds TOOLS_INCLUDES to selftests/lib.mk, so that all selftests can immediately and easily include the snapshotted header files. b) Uses $(TOOLS_INCLUDES) in the selftests/mm build. On today's Arch Linux, this already fixes all build errors except for a few userfaultfd.h (those will be addressed in a subsequent patch). [1] https://lore.kernel.org/all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: John Hubbard <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Mark Brown <[email protected]> Cc: Muhammad Usama Anjum <[email protected]> Cc: Suren Baghdasaryan <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Axel Rasmussen <[email protected]> Cc: Peter Xu <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent bd72205 commit e076eac

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

tools/testing/selftests/lib.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ ifeq ($(KHDR_INCLUDES),)
4848
KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
4949
endif
5050

51+
# In order to use newer items that haven't yet been added to the user's system
52+
# header files, add $(TOOLS_INCLUDES) to the compiler invocation in each
53+
# each selftest.
54+
# You may need to add files to that location, or to refresh an existing file. In
55+
# order to do that, run "make headers" from $(top_srcdir), then copy the
56+
# header file that you want from $(top_srcdir)/usr/include/... , to the matching
57+
# subdir in $(TOOLS_INCLUDE).
58+
TOOLS_INCLUDES := -isystem $(top_srcdir)/tools/include/uapi
59+
5160
# The following are built by lib.mk common compile rules.
5261
# TEST_CUSTOM_PROGS should be used by tests that require
5362
# custom build rule and prevent common build rule use.

tools/testing/selftests/mm/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ endif
3232
# LDLIBS.
3333
MAKEFLAGS += --no-builtin-rules
3434

35-
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES)
35+
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
3636
LDLIBS = -lrt -lpthread -lm
3737

3838
TEST_GEN_FILES = cow

0 commit comments

Comments
 (0)