Blame SOURCES/0007-morecore-tests-Run-tests-only-for-default-huge-page-.patch

0dfa60
From e472e326d31a125e21453d75cb46bba9cf387952 Mon Sep 17 00:00:00 2001
0dfa60
Message-Id: <e472e326d31a125e21453d75cb46bba9cf387952.1566225007.git.aquini@redhat.com>
0dfa60
In-Reply-To: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
0dfa60
References: <d42f467a923dfc09309acb7a83b42e3285fbd8f4.1566225007.git.aquini@redhat.com>
0dfa60
From: Sandipan Das <sandipan@linux.ibm.com>
0dfa60
Date: Thu, 15 Aug 2019 13:08:34 +0530
0dfa60
Subject: [RHEL7 PATCH 07/31] morecore: tests: Run tests only for default huge
0dfa60
 page size
0dfa60
0dfa60
The morecore tests (malloc, malloc-manysmall and heapshrink)
0dfa60
are not linked against libhugetlbfs and cannot invoke library
0dfa60
functions like gethugepagesize(). Hence, run these tests only
0dfa60
for the kernel's default huge page size.
0dfa60
0dfa60
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
0dfa60
Signed-off-by: Eric B Munson <emunson@mgebm.net>
0dfa60
Signed-off-by: Rafael Aquini <aquini@redhat.com>
0dfa60
---
0dfa60
 tests/run_tests.py | 81 +++++++++++++++++++++++++++++++++---------------------
0dfa60
 1 file changed, 49 insertions(+), 32 deletions(-)
0dfa60
0dfa60
diff --git a/tests/run_tests.py b/tests/run_tests.py
0dfa60
index 3c95a03..70c5a6a 100755
0dfa60
--- a/tests/run_tests.py
0dfa60
+++ b/tests/run_tests.py
0dfa60
@@ -362,6 +362,16 @@ def do_test_with_rlimit(rtype, limit, cmd, bits=None, **env):
0dfa60
     do_test(cmd, bits, **env)
0dfa60
     resource.setrlimit(rtype, oldlimit)
0dfa60
 
0dfa60
+def do_test_with_pagesize(pagesize, cmd, bits=None, **env):
0dfa60
+    """
0dfa60
+    Run a test case, testing with a specified huge page size and
0dfa60
+    each indicated word size.
0dfa60
+    """
0dfa60
+    if bits == None:
0dfa60
+        bits = wordsizes
0dfa60
+    for b in (set(bits) & wordsizes_by_pagesize[pagesize]):
0dfa60
+        run_test(pagesize, b, cmd, **env)
0dfa60
+
0dfa60
 def do_elflink_test(cmd, **env):
0dfa60
     """
0dfa60
     Run an elflink test case, skipping known-bad configurations.
0dfa60
@@ -563,15 +573,22 @@ def functional_tests():
0dfa60
     do_test("private")
0dfa60
     do_test("fork-cow")
0dfa60
     do_test("direct")
0dfa60
-    do_test("malloc")
0dfa60
-    do_test("malloc", LD_PRELOAD="libhugetlbfs.so", HUGETLB_MORECORE="yes")
0dfa60
-    do_test("malloc", LD_PRELOAD="libhugetlbfs.so", HUGETLB_MORECORE="yes",
0dfa60
-            HUGETLB_RESTRICT_EXE="unknown:none")
0dfa60
-    do_test("malloc", LD_PRELOAD="libhugetlbfs.so", HUGETLB_MORECORE="yes",
0dfa60
-            HUGETLB_RESTRICT_EXE="unknown:malloc")
0dfa60
-    do_test("malloc_manysmall")
0dfa60
-    do_test("malloc_manysmall", LD_PRELOAD="libhugetlbfs.so",
0dfa60
-            HUGETLB_MORECORE="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so",
0dfa60
+                          HUGETLB_MORECORE="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so",
0dfa60
+                          HUGETLB_MORECORE="yes",
0dfa60
+                          HUGETLB_RESTRICT_EXE="unknown:none")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so",
0dfa60
+                          HUGETLB_MORECORE="yes",
0dfa60
+                          HUGETLB_RESTRICT_EXE="unknown:malloc")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc_manysmall")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "malloc_manysmall",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so",
0dfa60
+                          HUGETLB_MORECORE="yes")
0dfa60
 
0dfa60
     # After upstream commit: (glibc-2.25.90-688-gd5c3fafc43) glibc has a
0dfa60
     # new per-thread caching mechanism that will NOT allow heapshrink test to
0dfa60
@@ -584,29 +601,29 @@ def functional_tests():
0dfa60
     # program context (not even with a constructor function), and the tunable
0dfa60
     # is only evaluated during malloc() initialization.
0dfa60
 
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0")
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
-            LD_PRELOAD="libheapshrink.so")
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
-            LD_PRELOAD="libhugetlbfs.so",
0dfa60
-            HUGETLB_MORECORE="yes")
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
-            LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
0dfa60
-            HUGETLB_MORECORE="yes")
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
-            LD_PRELOAD="libheapshrink.so",
0dfa60
-            HUGETLB_MORECORE="yes",
0dfa60
-            HUGETLB_MORECORE_SHRINK="yes")
0dfa60
-    do_test("heapshrink",
0dfa60
-            GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
-            LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
0dfa60
-            HUGETLB_MORECORE="yes",
0dfa60
-            HUGETLB_MORECORE_SHRINK="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
+                          LD_PRELOAD="libheapshrink.so")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so",
0dfa60
+                          HUGETLB_MORECORE="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
0dfa60
+                          HUGETLB_MORECORE="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
+                          LD_PRELOAD="libheapshrink.so",
0dfa60
+                          HUGETLB_MORECORE="yes",
0dfa60
+                          HUGETLB_MORECORE_SHRINK="yes")
0dfa60
+    do_test_with_pagesize(system_default_hpage_size, "heapshrink",
0dfa60
+                          GLIBC_TUNABLES="glibc.malloc.tcache_count=0",
0dfa60
+                          LD_PRELOAD="libhugetlbfs.so libheapshrink.so",
0dfa60
+                          HUGETLB_MORECORE="yes",
0dfa60
+                          HUGETLB_MORECORE_SHRINK="yes")
0dfa60
 
0dfa60
     do_test("heap-overflow", HUGETLB_VERBOSE="1", HUGETLB_MORECORE="yes")
0dfa60
 
0dfa60
-- 
0dfa60
1.8.3.1
0dfa60