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 <d...@au1.ibm.com> Index: libhugetlbfs/tests/run_tests.py =================================================================== --- libhugetlbfs.orig/tests/run_tests.py 2009-08-20 12:00:15.000000000 +1000 +++ libhugetlbfs/tests/run_tests.py 2009-08-20 12:09:34.000000000 +1000 @@ -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") -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Libhugetlbfs-devel mailing list Libhugetlbfs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel