Skip to contentSkip to conversation

selftests/mm: use pattern matching in .gitignore

RFC PATCH Superseded [email protected] 4 participants 7 messages Apr 21 – May 5

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 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.

---
 tools/testing/selftests/mm/.gitignore | 72 ++++-----------------------
 1 file changed, 11 insertions(+), 61 deletions(-)
tools/testing/selftests/mm/.gitignore +11 -61
index 83ad9454dd9d..92f9205d3996 100644
@@ -1,63 +1,13 @@
 # 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
+*
+!/**/
+!*.c
+!*.h
+!*.sh
+!.gitignore
+!Makefile
+!config
+!settings
+#Re-ignore generated files
 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
+*.mod.c
Signature · 1 line
2.54.0.rc1.555.g9c883467ad-goog
#1 lore raw
Quoted 8 lines · On 4/21/26 20:30, [email protected] wrote:

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.

That looks pretty nice. Any reason for the RFC? (iow, are you unsure about some side-effects?)

Signature · 3 lines
Cheers,

David
#2 lore raw
Quoted 11 lines · David Hildenbrand (Arm)
Quoted 8 lines · On 4/21/26 20:30, [email protected] wrote:

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.

That looks pretty nice. Any reason for the RFC? (iow, are you unsure about some side-effects?)

Exactly that. I verified that the build works fine, however I sent it as an RFC just to be cautious. I wanted to get some feedback in case this might introduce some unwanted behavior that I'm not aware of. :)

Thanks,
Pratyush

#3 lore raw
In reply to David Hildenbrand (Arm)

(Resending to correct David's email address. Apologies for the noise!)

Quoted 11 lines · David Hildenbrand (Arm)
Quoted 8 lines · On 4/21/26 20:30, [email protected] wrote:

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.

That looks pretty nice. Any reason for the RFC? (iow, are you unsure about some side-effects?)

Exactly that. I verified that the build works fine, however I sent it as an RFC just to be cautious. I wanted to get some feedback in case this might introduce some unwanted behavior that I'm not aware of. :)

Thanks,
Pratyush

#4 lore raw
Quoted 2 lines · On 4/22/26 21:08, [email protected] wrote:

(Resending to correct David's email address. Apologies for the noise!)

Heh, no worries, I didn't even notice.

As long as you CC one of the mailing lists I'm subscribed to, even mails to my old RH address will still hit my inbox.

Quoted 10 lines · David Hildenbrand (Arm)
Quoted 9 lines · On 4/21/26 20:30, [email protected] wrote:
Quoted 8 lines

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.

Quoted 6 lines
Quoted 2 lines

That looks pretty nice. Any reason for the RFC? (iow, are you unsure about some side-effects?)

Exactly that. I verified that the build works fine, however I sent it as an RFC just to be cautious. I wanted to get some feedback in case this might introduce some unwanted behavior that I'm not aware of. :)

After taking a peek at the KVM one, I think what you propose makes perfect sense.

I do wonder, whether we want to make our lives easier and rename "local_config.h" to something like "local_config.h_gen", so we don't need the "re-ignore" part.

Signature · 3 lines
Cheers,

David
#5 lore raw
Quoted 27 lines · David Hildenbrand (Arm)
Quoted 2 lines · On 4/22/26 21:08, [email protected] wrote:

(Resending to correct David's email address. Apologies for the noise!)

Heh, no worries, I didn't even notice.

As long as you CC one of the mailing lists I'm subscribed to, even mails to my old RH address will still hit my inbox.

Quoted 10 lines · David Hildenbrand (Arm)
Quoted 9 lines · On 4/21/26 20:30, [email protected] wrote:
Quoted 8 lines

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.

Quoted 6 lines
Quoted 2 lines

That looks pretty nice. Any reason for the RFC? (iow, are you unsure about some side-effects?)

Exactly that. I verified that the build works fine, however I sent it as an RFC just to be cautious. I wanted to get some feedback in case this might introduce some unwanted behavior that I'm not aware of. :)

Quoted 5 lines

After taking a peek at the KVM one, I think what you propose makes perfect sense.

I do wonder, whether we want to make our lives easier and rename "local_config.h" to something like "local_config.h_gen", so we don't need the "re-ignore" part.

There's also the *.mod.c part, but I am not sure why that is needed as the current .gitignore doesn't have anything with .mod.c in it.

reviewer Reviewed-by on v1 1/1
#6 lore raw
In reply to [email protected]
Quoted 10 lines · On Tue, Apr 21, 2026 at 06:30:00PM +0000, [email protected] wrote:

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.

Niceee :) a lot of red, love it.

Assuming you have confirmed this is all working correctly, please un-RFC and feel free to add:

Quoted 86 lines
---
 tools/testing/selftests/mm/.gitignore | 72 ++++-----------------------
 1 file changed, 11 insertions(+), 61 deletions(-)
tools/testing/selftests/mm/.gitignore +11 -62
index 83ad9454dd9d..92f9205d3996 100644
@@ -1,63 +1,13 @@
 # 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
+*
+!/**/
+!*.c
+!*.h
+!*.sh
+!.gitignore
+!Makefile
+!config
+!settings
+#Re-ignore generated files
 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
+*.mod.c
--

2.54.0.rc1.555.g9c883467ad-goog