[PATCH] tests: elf: Fix flaky thp tests

Yury Khrustalev <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Message-ID <[email protected]>
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]>

---
Passes tests on aarch64 and x86. OK for trunk?
Base commit: a367c5da61

Problem with the tests discussed in
https://inbox.sourceware.org/libc-alpha/[email protected]/
---
 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 34856a3b2f..79d29ee1ac 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -840,7 +840,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)
 
@@ -849,7 +849,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)
 
@@ -858,7 +858,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)
 
@@ -867,7 +867,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)
 
@@ -875,7 +875,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)
 
@@ -883,7 +883,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)
 
@@ -891,7 +891,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)
 
@@ -900,7 +901,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)
 
@@ -909,7 +910,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]
-- 
2.47.3
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.