[glibc] tests: elf: Fix flaky thp tests

Yury Khrustalev via Glibc-cvs <[email protected]>
Newsgroups gmane.comp.lib.glibc.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9c86ea03aa6879ec79972147b21d3f52cb921cdb

commit 9c86ea03aa6879ec79972147b21d3f52cb921cdb
Author: Yury Khrustalev <[email protected]>
Date:   Mon Aug 24 15:35:53 2026 +0100

    tests: elf: Fix flaky thp tests
    
    Several tests rely on a madvise syscall to appear in strace output
    (or not appear in case of 'disable' tests). This syscall may occur
    in malloc. To avoid this from happening, we use malloc tunable to
    disable hugetlb for these tests.
    
    Suggested-by: Adhemerval Zanella <[email protected]>
    Reviewed-by: Adhemerval Zanella <[email protected]>

Diff:
---
 sysdeps/unix/sysv/linux/Makefile | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index 14a56d5cc3..a505253d17 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -844,7 +844,7 @@ $(objpfx)strace-tst-thp-1-enabled.out: \
   $(objpfx)tst-thp-1
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1 > $@; \
 	  $(evaluate-test)
 
@@ -853,7 +853,7 @@ $(objpfx)strace-tst-thp-1-disabled.out: \
   $(objpfx)tst-thp-1
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1 > $@; \
 	  $(evaluate-test)
 
@@ -862,7 +862,7 @@ $(objpfx)strace-tst-thp-1-pde-enabled.out: \
   $(objpfx)tst-thp-1-pde
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-pde > $@; \
 	  $(evaluate-test)
 
@@ -871,7 +871,7 @@ $(objpfx)strace-tst-thp-1-pde-disabled.out: \
   $(objpfx)tst-thp-1-pde
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-pde > $@; \
 	  $(evaluate-test)
 
@@ -879,7 +879,7 @@ $(objpfx)strace-tst-thp-1-static-enabled.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh \
   $(objpfx)tst-thp-1-static
 	$(SHELL) $< '' '$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-static > $@; \
 	  $(evaluate-test)
 
@@ -887,7 +887,7 @@ $(objpfx)strace-tst-thp-1-static-disabled.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh \
   $(objpfx)tst-thp-1-static
 	$(SHELL) $< '' '$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-1-static > $@; \
 	  $(evaluate-test)
 
@@ -895,7 +895,8 @@ $(objpfx)strace-tst-thp-align-default.out: \
   $(..)sysdeps/unix/sysv/linux/strace-tst-thp.sh $(objpfx)ld.so \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
-		'$(test-wrapper-env)' '$(run-program-env)' \
+		'$(test-wrapper-env)' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 
@@ -904,7 +905,7 @@ $(objpfx)strace-tst-thp-align-enabled.out: \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=1:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 
@@ -913,7 +914,7 @@ $(objpfx)strace-tst-thp-align-disabled.out: \
   $(objpfx)tst-thp-align $(objpfx)tst-thp-size-mod.so
 	$(SHELL) $< '$(strace-test-via-rtld-prefix)' \
 		'$(test-wrapper-env)' \
-		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0' \
+		'$(run-program-env) GLIBC_TUNABLES=glibc.elf.thp=0:glibc.malloc.hugetlb=0' \
 		$(objpfx)tst-thp-align > $@; \
 	  $(evaluate-test)
 endif # [madvise]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.