aboutsummaryrefslogtreecommitdiff
path: root/tests/run_tests.py
diff options
context:
space:
mode:
authorDavid Gibson <dwg@au1.ibm.com>2009-08-20 12:17:22 +1000
committerEric B Munson <ebmunson@us.ibm.com>2009-08-21 10:57:00 +0100
commitc01c3bf9e00fa6c927f575b5fb0a7ae9172957f0 (patch)
tree46af15dc409c338fd21c7f2e9da8a2b0cb6a18c3 /tests/run_tests.py
parent6ada2a2aa4bfd9f946a9d21d3a88baaaa8f50276 (diff)
downloadlibhugetlbfs-c01c3bf9e00fa6c927f575b5fb0a7ae9172957f0.tar.gz
Make run_tests.py set rlimits for mlock and stack_grow_into_huge tests
The mlock and stack_grow_into_huge testcases require very large amounts of locked memory and stack space respectively - larger than the default ulimits set by some distros. Originally, I avoided having the testcases or the wrapper script set the ulimits for these tests so that the whole test script could be run without root. However, these days the testsuite does require root and uses it to set some other system limits (e.g. the shm segment size limits). So, it's silly not to set the stack and locked memory limits for these tests as well. Therefore, this patch adds code to temporarily adjust the relevant rlimits around these testcases. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'tests/run_tests.py')
-rwxr-xr-xtests/run_tests.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/run_tests.py b/tests/run_tests.py
index 71ad35f..29c3bc6 100755
--- a/tests/run_tests.py
+++ b/tests/run_tests.py
@@ -4,6 +4,7 @@ import subprocess
import os
import sys
import getopt
+import resource
# The superset of wordsizes that should be tested (default 32, 64)
wordsizes = set()
@@ -311,6 +312,15 @@ def do_test(cmd, pre="", bits=None, desc=""):
for b in (set(bits) & wordsizes_by_pagesize[p]):
run_test(p, b, cmd, pre, desc)
+def do_test_with_rlimit(rtype, limit, cmd, pre="", bits=None, desc=""):
+ """
+ Run a test case with a temporarily altered resource limit.
+ """
+ oldlimit = resource.getrlimit(rtype)
+ resource.setrlimit(rtype, (limit, limit))
+ do_test(cmd, pre, bits, desc)
+ resource.setrlimit(rtype, oldlimit)
+
def do_elflink_test(cmd, pre="", desc=""):
"""
Run an elflink test case, skipping known-bad configurations.
@@ -461,7 +471,7 @@ def functional_tests():
do_test("truncate")
do_test("shared")
do_test("mprotect")
- do_test("mlock")
+ do_test_with_rlimit(resource.RLIMIT_MEMLOCK, -1, "mlock")
do_test("misalign")
# Specific kernel bug tests
@@ -476,7 +486,7 @@ def functional_tests():
do_test("truncate_above_4GB")
do_test("brk_near_huge")
do_test("task-size-overrun")
- do_test("stack_grow_into_huge")
+ do_test_with_rlimit(resource.RLIMIT_STACK, -1, "stack_grow_into_huge")
if dangerous == 1:
do_test("readahead_reserve")
do_test("madvise_reserve")