summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py30
1 files changed, 28 insertions, 2 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 566e54b..86961b0 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -25,6 +25,7 @@ Command line options:
-N: nocoverdir -- Put coverage files alongside modules
-L: runleaks -- run the leaks(1) command just before exit
-R: huntrleaks -- search for reference leaks (needs debug build, v. slow)
+-M: memlimit -- run very large memory-consuming tests
If non-option arguments are present, they are names for tests to run,
unless -x is given, in which case they are names for tests not to run.
@@ -63,6 +64,19 @@ of times further it is run and 'fname' is the name of the file the
reports are written to. These parameters all have defaults (5, 4 and
"reflog.txt" respectively), so the minimal invocation is '-R ::'.
+-M runs tests that require an exorbitant amount of memory. These tests
+typically try to ascertain containers keep working when containing more than
+2 bilion objects, and only work on 64-bit systems. The passed-in memlimit,
+which is a string in the form of '2.5Gb', determines howmuch memory the
+tests will limit themselves to (but they may go slightly over.) The number
+shouldn't be more memory than the machine has (including swap memory). You
+should also keep in mind that swap memory is generally much, much slower
+than RAM, and setting memlimit to all available RAM or higher will heavily
+tax the machine. On the other hand, it is no use running these tests with a
+limit of less than 2.5Gb, and many require more than 20Gb. Tests that expect
+to use more than memlimit memory will be skipped. The big-memory tests
+generally run very, very long.
+
-u is used to specify which special resource intensive tests to run,
such as those requiring large file support or network connectivity.
The argument is a comma-separated list of words indicating the
@@ -124,6 +138,14 @@ if sys.maxint > 0x7fffffff:
warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning,
"<string>")
+# Ignore ImportWarnings that only occur in the source tree,
+# (because of modules with the same name as source-directories in Modules/)
+for mod in ("ctypes", "gzip", "zipfile", "tarfile", "encodings.zlib_codec",
+ "test.test_zipimport", "test.test_zlib", "test.test_zipfile",
+ "test.test_codecs", "test.string_tests"):
+ warnings.filterwarnings(module=".*%s$" % (mod,),
+ action="ignore", category=ImportWarning)
+
# MacOSX (a.k.a. Darwin) has a default stack size that is too small
# for deeply recursive regular expressions. We see this as crashes in
# the Python test suite when running test_re.py and test_sre.py. The
@@ -180,12 +202,12 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
test_support.record_original_stdout(sys.stdout)
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:w',
+ opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:',
['help', 'verbose', 'quiet', 'generate',
'exclude', 'single', 'random', 'fromfile',
'findleaks', 'use=', 'threshold=', 'trace',
'coverdir=', 'nocoverdir', 'runleaks',
- 'huntrleaks=', 'verbose2',
+ 'huntrleaks=', 'verbose2', 'memlimit=',
])
except getopt.error, msg:
usage(2, msg)
@@ -241,6 +263,8 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False,
huntrleaks[1] = int(huntrleaks[1])
if len(huntrleaks[2]) == 0:
huntrleaks[2] = "reflog.txt"
+ elif o in ('-M', '--memlimit'):
+ test_support.set_memlimit(a)
elif o in ('-u', '--use'):
u = [x.lower() for x in a.split(',')]
for r in u:
@@ -521,6 +545,7 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
def cleanup():
import _strptime, linecache, warnings, dircache
import urlparse, urllib, urllib2, mimetypes, doctest
+ import struct
from distutils.dir_util import _path_created
_path_created.clear()
warnings.filters[:] = fs
@@ -537,6 +562,7 @@ def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False):
dircache.reset()
linecache.clearcache()
mimetypes._default_mime_types()
+ struct._cache.clear()
doctest.master = None
if indirect_test:
def run_the_test():