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

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