selftests/mm: use pattern matching in .gitignore
Subsystems (4)
v3 cover selftests/mm: use pattern matching in .gitignore
From: Pratyush Mallick <[email protected]>
The current selftests/mm/.gitignore hardcodes each generated test binary by name, which requires manual updates every time a new test is added.
This series switches to a pattern-matching approach (similar to KVM selftests), ignoring everything by default and allowing specific source extensions. To accommodate this without tracking generated headers, local_config.h is renamed to local_config.h_gen.
Changelog since v2:
- Split the changes into two separate patches (header rename and .gitignore update)
- Added Suggested-by for David Hildenbrand for the header rename approach.
- Dropped David's and Yosry's Reviewed-by tags.
- Kept Lorenzo Stoakes's Reviewed-by and added Mike Rapoport's Acked-by.
Changelog since v1 (RFC):
- Renamed local_config.h to local_config.h_gen to avoid conflict with !*.h.
- Updated Makefile, check_config.sh, and affected .c files for the rename.
- Removed *.mod.c as it was unnecessary.
Pratyush Mallick (2):
selftests/mm: use pattern matching in .gitignore selftests/mm: rename local_config.h to local_config.h_gen
tools/testing/selftests/mm/.gitignore | 71 +++------------------- tools/testing/selftests/mm/Makefile | 6 +- tools/testing/selftests/mm/check_config.sh | 2 +- tools/testing/selftests/mm/cow.c | 2 +- tools/testing/selftests/mm/gup_longterm.c | 2 +- 5 files changed, 15 insertions(+), 68 deletions(-)
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
PATCH v3 1/2 selftests/mm: use pattern matching in .gitignore
From: Pratyush Mallick <[email protected]>
The current .gitignore hardcodes each generated test binary by name, requiring updates every time a new test is added.
Switch to the patten-matching approach similar to KVM:selftests. Ignore everything by default and then allow source extensions (.c, .h, .sh) and tracked non-source files.
Note that un-ignoring *.h files causes the generated local_config.h build artifact to incorrectly become untracked. A subsequent patch will rename this header to resolve the issue.
--- tools/testing/selftests/mm/.gitignore | 71 ++++----------------------- 1 file changed, 9 insertions(+), 62 deletions(-)
tools/testing/selftests/mm/.gitignore +9 -62
@@ -1,63 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only -cow -hugepage-mmap -hugepage-mremap -hugepage-shm -hugepage-vmemmap -hugetlb-madvise -hugetlb-read-hwpoison -hugetlb-soft-offline -khugepaged -map_hugetlb -map_populate -thuge-gen -compaction_test -memory-failure -migration -mlock2-tests -mrelease_test -mremap_dontunmap -mremap_test -on-fault-limit -transhuge-stress -pagemap_ioctl -pfnmap -process_madv -*.tmp* -protection_keys -protection_keys_32 -protection_keys_64 -madv_populate -uffd-stress -uffd-unit-tests -uffd-wp-mremap -mlock-intersect-test -mlock-random-test -virtual_address_range -gup_test -va_128TBswitch -map_fixed_noreplace -write_to_hugetlbfs -hmm-tests -memfd_secret -soft-dirty -split_huge_page_test -ksm_tests -local_config.h -local_config.mk -ksm_functional_tests -mdwe_test -gup_longterm -mkdirty -va_high_addr_switch -hugetlb_fault_after_madv -hugetlb_madv_vs_map -mseal_test -droppable -hugetlb_dio -pkey_sighandler_tests_32 -pkey_sighandler_tests_64 -guard-regions -merge -prctl_thp_disable -rmap +* +!/**/ +!*.c +!*.h +!*.sh +!.gitignore +!Makefile +!config +!settings
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
PATCH v3 2/2 selftests/mm: rename local_config.h to local_config.h_gen
In reply to [email protected]From: Pratyush Mallick <[email protected]>
Because local_config.h is a generated build artifact, un-ignoring all .h files causes it to incorrectly show up as an untracked file in git status.
Rename it to local_config.h_gen so it no longer matches the !*.h inclusion rule.
--- tools/testing/selftests/mm/Makefile | 6 +++--- tools/testing/selftests/mm/check_config.sh | 2 +- tools/testing/selftests/mm/cow.c | 2 +- tools/testing/selftests/mm/gup_longterm.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/mm/Makefile +3 -3
@@ -5,7 +5,7 @@ # script so kunit knows to run it, and add it to the list below. # If you do not YOUR TESTS WILL NOT RUN IN THE CI. -LOCAL_HDRS += $(selfdir)/mm/local_config.h $(top_srcdir)/mm/gup_test.h +LOCAL_HDRS += $(selfdir)/mm/local_config.h_gen $(top_srcdir)/mm/gup_test.h LOCAL_HDRS += $(selfdir)/mm/mseal_helpers.h include local_config.mk
@@ -259,10 +259,10 @@ $(OUTPUT)/migration: LDLIBS += -lnuma $(OUTPUT)/rmap: LDLIBS += -lnuma -local_config.mk local_config.h: check_config.sh +local_config.mk local_config.h_gen: check_config.sh CC="$(CC)" CFLAGS="$(CFLAGS)" ./check_config.sh -EXTRA_CLEAN += local_config.mk local_config.h +EXTRA_CLEAN += local_config.mk local_config.h_gen ifeq ($(IOURING_EXTRA_LIBS),) all: warn_missing_liburing
tools/testing/selftests/mm/check_config.sh +1 -1
@@ -4,7 +4,7 @@ # Probe for libraries and create header files to record the results. Both C # header files and Makefile include fragments are created. -OUTPUT_H_FILE=local_config.h +OUTPUT_H_FILE=local_config.h_gen OUTPUT_MKFILE=local_config.mk tmpname=$(mktemp)
tools/testing/selftests/mm/cow.c +1 -1
@@ -21,7 +21,7 @@#include <sys/wait.h> #include <linux/memfd.h> -#include "local_config.h" +#include "local_config.h_gen" #ifdef LOCAL_CONFIG_HAVE_LIBURING #include <liburing.h> #endif /* LOCAL_CONFIG_HAVE_LIBURING */
tools/testing/selftests/mm/gup_longterm.c +1 -1
@@ -21,7 +21,7 @@#include <linux/magic.h> #include <linux/memfd.h> -#include "local_config.h" +#include "local_config.h_gen" #ifdef LOCAL_CONFIG_HAVE_LIBURING #include <liburing.h> #endif /* LOCAL_CONFIG_HAVE_LIBURING */
Signature · 1 line
2.54.0.563.g4f69b47b94-goog
Quoted 17 lines · On Mon, 11 May 2026 17:34:09 +0000 [email protected] wrote:
From: Pratyush Mallick <[email protected]>
The current selftests/mm/.gitignore hardcodes each generated test binary by name, which requires manual updates every time a new test is added.
This series switches to a pattern-matching approach (similar to KVM selftests), ignoring everything by default and allowing specific source extensions. To accommodate this without tracking generated headers,
local_config.his renamed to local_config.h_gen.Changelog since v2:
- Split the changes into two separate patches (header rename and .gitignore update)
- Added Suggested-by for David Hildenbrand for the header rename approach.
- Dropped David's and Yosry's Reviewed-by tags.
- Kept Lorenzo Stoakes's Reviewed-by and added Mike Rapoport's Acked-by.
Quoted 4 lines
Changelog since v1 (RFC):
- Renamedlocal_config.hto local_config.h_gen to avoid conflict with !*.h.
- UpdatedMakefile,check_config.sh, and affected .c files for the rename.
- Removed *.mod.c as it was unnecessary.
Adding previous revision links together [1] would be helpful for people who willing to see details of previous discussions.
Quoted 4 lines
Pratyush Mallick (2):
selftests/mm: use pattern matching in .gitignore selftests/mm: renamelocal_config.hto local_config.h_gen
So, after applying the first patch, we may show local_config.h unexpectedly shown on 'git status' output? Maybe too trivial thing, but I'm wondering if we already considered doing the renaming first.
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ
[...]
Hi Pratyush and SeongJae!
Quoted 28 lines · SeongJae Park
Quoted 17 lines · On Mon, 11 May 2026 17:34:09 +0000 [email protected] wrote:
From: Pratyush Mallick <[email protected]>
The current selftests/mm/.gitignore hardcodes each generated test binary by name, which requires manual updates every time a new test is added.
This series switches to a pattern-matching approach (similar to KVM selftests), ignoring everything by default and allowing specific source extensions. To accommodate this without tracking generated headers,
local_config.his renamed to local_config.h_gen.Changelog since v2:
- Split the changes into two separate patches (header rename and .gitignore update)
- Added Suggested-by for David Hildenbrand for the header rename approach.
- Dropped David's and Yosry's Reviewed-by tags.
- Kept Lorenzo Stoakes's Reviewed-by and added Mike Rapoport's Acked-by.Quoted 4 lines
Changelog since v1 (RFC):
- Renamedlocal_config.hto local_config.h_gen to avoid conflict with !*.h.
- UpdatedMakefile,check_config.sh, and affected .c files for the rename.
- Removed *.mod.c as it was unnecessary.Adding previous revision links together [1] would be helpful for people who willing to see details of previous discussions.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Pratyush Mallick (2):
selftests/mm: use pattern matching in .gitignore selftests/mm: renamelocal_config.hto local_config.h_genSo, after applying the first patch, we may show
local_config.hunexpectedly shown on 'git status' output? Maybe too trivial thing, but I'm wondering if we already considered doing the renaming first.
Just a gentle ping on this patchset, since it has been some time since the last discussion :).
Would it make sense to reorder the patches as SeongJae suggested and respin? Pratyush, if you don't have time to send a v4, I would be happy to prepare and send it. Please let me know if you'd like me to.
Quoted 9 lines
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ[...]
Thanks,
Sarthak
Hi Sarthak,
Thanks for the reminder. I completely forgot about this.
Will send a V4 with the patches reordered.
Regards,
Pratyush
Quoted 60 lines · Sarthak Sharma
Hi Pratyush and SeongJae!
Quoted 28 lines · SeongJae Park
Quoted 17 lines · On Mon, 11 May 2026 17:34:09 +0000 [email protected] wrote:
From: Pratyush Mallick <[email protected]>
The current selftests/mm/.gitignore hardcodes each generated test binary by name, which requires manual updates every time a new test is added.
This series switches to a pattern-matching approach (similar to KVM selftests), ignoring everything by default and allowing specific source extensions. To accommodate this without tracking generated headers,
local_config.his renamed to local_config.h_gen.Changelog since v2:
- Split the changes into two separate patches (header rename and .gitignore update)
- Added Suggested-by for David Hildenbrand for the header rename approach.
- Dropped David's and Yosry's Reviewed-by tags.
- Kept Lorenzo Stoakes's Reviewed-by and added Mike Rapoport's Acked-by.Quoted 4 lines
Changelog since v1 (RFC):
- Renamedlocal_config.hto local_config.h_gen to avoid conflict with !*.h.
- UpdatedMakefile,check_config.sh, and affected .c files for the rename.
- Removed *.mod.c as it was unnecessary.Adding previous revision links together [1] would be helpful for people who willing to see details of previous discussions.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Pratyush Mallick (2):
selftests/mm: use pattern matching in .gitignore selftests/mm: renamelocal_config.hto local_config.h_genSo, after applying the first patch, we may show
local_config.hunexpectedly shown on 'git status' output? Maybe too trivial thing, but I'm wondering if we already considered doing the renaming first.Just a gentle ping on this patchset, since it has been some time since the last discussion :).
Would it make sense to reorder the patches as SeongJae suggested and respin? Pratyush, if you don't have time to send a v4, I would be happy to prepare and send it. Please let me know if you'd like me to.
Quoted 9 lines
[1] https://docs.kernel.org/process/submitting-patches.html#commentary
Thanks,
SJ[...]
Thanks,
Sarthak