From: <nr...@us...> - 2008-06-16 05:23:41
|
Revision: 4648 http://jython.svn.sourceforge.net/jython/?rev=4648&view=rev Author: nriley Date: 2008-06-15 22:23:39 -0700 (Sun, 15 Jun 2008) Log Message: ----------- enable test_posix Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-16 03:10:15 UTC (rev 4647) +++ branches/asm/Lib/test/regrtest.py 2008-06-16 05:23:39 UTC (rev 4648) @@ -994,7 +994,6 @@ test_parser test_plistlib test_poll - test_posix test_pty test_pwd test_pyexpat This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2008-06-24 21:31:30
|
Revision: 4753 http://jython.svn.sourceforge.net/jython/?rev=4753&view=rev Author: pjenvey Date: 2008-06-24 14:31:29 -0700 (Tue, 24 Jun 2008) Log Message: ----------- disable test_asynchat for now, re #1064 Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-24 20:31:06 UTC (rev 4752) +++ branches/asm/Lib/test/regrtest.py 2008-06-24 21:31:29 UTC (rev 4753) @@ -949,6 +949,7 @@ """ test_aepack test_al + test_asynchat test_audioop test_bsddb test_bsddb185 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2008-06-25 20:46:50
|
Revision: 4771 http://jython.svn.sourceforge.net/jython/?rev=4771&view=rev Author: pjenvey Date: 2008-06-25 13:46:49 -0700 (Wed, 25 Jun 2008) Log Message: ----------- from: http://svn.python.org/projects/python/branches/release25-maint/Lib/test/regrtest.py@54228 Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-25 20:27:31 UTC (rev 4770) +++ branches/asm/Lib/test/regrtest.py 2008-06-25 20:46:49 UTC (rev 4771) @@ -8,18 +8,24 @@ Command line options: --v: verbose -- run tests in verbose mode with output to stdout --q: quiet -- don't print anything except if a test fails --g: generate -- write the output file for a test instead of comparing it --a: all -- execute tests in all test(/regrtest.py) dirs on sys.path - : broad -- execute tests in all test(/regrtest.py) dirs on sys.path --x: exclude -- arguments are tests to *exclude* --r: random -- randomize test execution order --m: memo -- save results to file --l: findleaks -- if GC is available detect tests that leak memory --u: use -- specify which special resource intensive tests to run --h: help -- print this text and exit --e: expected -- run only tests that are expected to run and pass +-v: verbose -- run tests in verbose mode with output to stdout +-w: verbose2 -- re-run failed tests in verbose mode +-q: quiet -- don't print anything except if a test fails +-g: generate -- write the output file for a test instead of comparing it +-x: exclude -- arguments are tests to *exclude* +-s: single -- run only a single test (see below) +-r: random -- randomize test execution order +-f: fromfile -- read names of tests to run from a file (see below) +-l: findleaks -- if GC is available detect tests that leak memory +-u: use -- specify which special resource intensive tests to run +-h: help -- print this text and exit +-t: threshold -- call gc.set_threshold(N) +-T: coverage -- turn on code coverage using the trace module +-D: coverdir -- Directory where coverage files are put +-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. @@ -27,6 +33,52 @@ -v is incompatible with -g and does not compare test output files. +-T turns on code coverage tracing with the trace module. + +-D specifies the directory where coverage files are put. + +-N Put coverage files alongside modules. + +-s means to run only a single test and exit. This is useful when +doing memory analysis on the Python interpreter (which tend to consume +too many resources to run the full regression test non-stop). The +file /tmp/pynexttest is read to find the next test to run. If this +file is missing, the first test_*.py file in testdir or on the command +line is used. (actually tempfile.gettempdir() is used instead of +/tmp). + +-f reads the names of tests from the file given as f's argument, one +or more test names per line. Whitespace is ignored. Blank lines and +lines beginning with '#' are ignored. This is especially useful for +whittling down failures involving interactions among tests. + +-L causes the leaks(1) command to be run just before exit if it exists. +leaks(1) is available on Mac OS X and presumably on some other +FreeBSD-derived systems. + +-R runs each test several times and examines sys.gettotalrefcount() to +see if the test appears to be leaking references. The argument should +be of the form stab:run:fname where 'stab' is the number of times the +test is run to let gettotalrefcount settle down, 'run' is the number +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 billion objects, which only works on 64-bit systems. There are also some +tests that try to exhaust the address space of the process, which only makes +sense on 32-bit systems with at least 2Gb of memory. 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 @@ -34,6 +86,10 @@ all - Enable all special resources. + audio - Tests that use the audio device. (There are known + cases of broken audio drivers that can crash Python or + even the Linux kernel.) + curses - Tests that use curses and will modify the terminal's state and output modes. @@ -44,156 +100,86 @@ network - It is okay to run tests that use external network resource, e.g. testing SSL support for sockets. - subprocess Run tests that invoke subprocesses, in particular - test_subprocess. + bsddb - It is okay to run the bsddb testsuite, which takes + a long time to complete. + decimal - Test the decimal module against a large suite that + verifies compliance with standards. + + compiler - Test the compiler package by compiling all the source + in the standard library and test suite. This takes + a long time. Enabling this resource also allows + test_tokenize to verify round-trip lexing on every + file in the test library. + + subprocess Run all tests for the subprocess module. + + urlfetch - It is okay to download files required on testing. + To enable all resources except one, use '-uall,-<resource>'. For -example, to run all the tests except for the network tests, give the -option '-uall,-network'. +example, to run all the tests except for the bsddb tests, give the +option '-uall,-bsddb'. """ +import os import sys -import os import getopt +import random +import warnings +import re +import cStringIO import traceback -import random -import StringIO -from test import test_support -sys.modules['test_support'] = test_support +# I see no other way to suppress these warnings; +# putting them in test_grammar.py has no effect: +warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, + ".*test.test_grammar$") +if sys.maxint > 0x7fffffff: + # Also suppress them in <string>, because for 64-bit platforms, + # that's where test_grammar.py hides them. + warnings.filterwarnings("ignore", "hex/oct constants", FutureWarning, + "<string>") -# interim stuff +# 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) -# !!! minimal (std) tests? - -def clean_sys_path(): - new_sys_path = [] - for p in sys.path: - if os.path.isfile(os.path.join(p,'regrtest.py')): - continue - new_sys_path.append(p) - sys.path = new_sys_path - -ALL = 0 - -def findtestdirs(all=ALL): - testdirs = [] - j = os.path.join - for p in sys.path: - p = j(p,'test') - if os.path.isfile(j(p,'regrtest.py')): - testdirs.append(p) - if not all: - break - return testdirs - -def findalltests(testdir=None, stdtests=[], nottests=[],all=ALL): - if testdir or not all: - return findtests(testdir, stdtests, nottests) +# 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 +# fix is to set the stack limit to 2048. +# This approach may also be useful for other Unixy platforms that +# suffer from small default stack limits. +if sys.platform == 'darwin': + try: + import resource + except ImportError: + pass else: - tests = {} - testdirs = findtestdirs(all) - for dir in testdirs: - for test in findtests(dir,stdtests,nottests): - tests[test] = 1 + soft, hard = resource.getrlimit(resource.RLIMIT_STACK) + newsoft = min(hard, max(soft, 1024*2048)) + resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard)) - tests = tests.keys() - tests.sort() - - return tests +from test import test_support -def savememo(memo,good,bad,skipped): - f = open(memo,'w') - try: - for n,l in [('good',good),('bad',bad),('skipped',skipped)]: - print >>f,"%s = [" % n - for x in l: - print >>f," %r," % x - print >>f," ]" - finally: - f.close() - -class _Args: +RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', + 'decimal', 'compiler', 'subprocess', 'urlfetch') - def __init__(self,txt): - self.args = [] - for s in txt.split('\n'): - self.pos = 0 - self.chunk = 0 - self.s = s - self.state = self.space - for ch in s: - self.state(ch) - self.pos += 1 - if self.state == self.quoted: - raise Exception,"Expected closing quote for arg" - self.state('"') - def space(self,ch): - if ch.isspace(): - pass - elif ch == '"': - self.state = self.quoted - else: - self.chunk = 1 - self.state = self.unquoted - - def quoted(self,ch): - if ch == '"': - if not self.s[self.pos-1] == '\\': - arg = self.s[self.pos-self.chunk:self.pos]; - arg = arg.replace('\\"','"').replace('\\\\','\\') - self.args.append(arg) - self.chunk = 0 - self.state = self.space - return - self.chunk += 1 - - def unquoted(self,ch): - if ch.isspace(): - self.state = self.space - elif ch == '"': - self.state = self.quoted - else: - self.chunk += 1 - return - self.args.append(self.s[self.pos-self.chunk:self.pos]) - self.chunk = 0 - -def _loadargs(fn): - f=open(fn,'r') - txt = f.read() - f.close() - return _Args(txt).args - -_INDIRECTARGS = '@' - -def with_indirect_args(args): - new_args = [] - for arg in args: - if arg.startswith(_INDIRECTARGS): - new_args.extend(_loadargs(arg[1:])) - else: - new_args.append(arg) - return new_args - - -# - * - - - - -RESOURCE_NAMES = ['curses', 'largefile', 'network', 'subprocess'] - - def usage(code, msg=''): print __doc__ if msg: print msg sys.exit(code) -def main(tests=None, testdir=None, verbose=0, quiet=0, generate=0, - exclude=0, single=0, randomize=0, findleaks=0, - use_resources=None, expected=0, allran=1): +def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, + exclude=False, single=False, randomize=False, fromfile=None, + findleaks=False, use_resources=None, trace=False, coverdir='coverage', + runleaks=False, huntrleaks=False, verbose2=False): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -210,69 +196,77 @@ command-line will be used. If that's empty, too, then all *.py files beginning with test_ will be used. - The other default arguments (verbose, quiet, generate, exclude, - randomize, findleaks, and use_resources) allow programmers - calling main() directly to set the values that would normally be - set by flags on the command line. - + The other default arguments (verbose, quiet, generate, exclude, single, + randomize, findleaks, use_resources, trace and coverdir) allow programmers + calling main() directly to set the values that would normally be set by + flags on the command line. """ test_support.record_original_stdout(sys.stdout) try: - args = with_indirect_args(sys.argv[1:]) - opts, args = getopt.getopt(args, 'hvgqxrlu:am:e', + opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:', ['help', 'verbose', 'quiet', 'generate', - 'exclude', 'random', 'expected', - 'findleaks', 'use=','all','memo=', - 'broad','oneonly=']) + 'exclude', 'single', 'random', 'fromfile', + 'findleaks', 'use=', 'threshold=', 'trace', + 'coverdir=', 'nocoverdir', 'runleaks', + 'huntrleaks=', 'verbose2', 'memlimit=', + ]) except getopt.error, msg: usage(2, msg) # Defaults if use_resources is None: use_resources = [] - - all = 0 - memo = None - oneonly = [] - - def strip_py(args): - for i in range(len(args)): - # Strip trailing ".py" from arguments - if args[i][-3:] == os.extsep+'py': - args[i] = args[i][:-3] - return None - for o, a in opts: if o in ('-h', '--help'): usage(0) elif o in ('-v', '--verbose'): verbose += 1 + elif o in ('-w', '--verbose2'): + verbose2 = True elif o in ('-q', '--quiet'): - quiet = 1; + quiet = True; verbose = 0 elif o in ('-g', '--generate'): - generate = 1 - elif o in ('-a', '--all'): - all = 1 - elif o in ('--broad',): - all = 1 - elif o in ('--oneonly',): - oneonly = a.split(',') - strip_py(oneonly) - allran = 0 + generate = True elif o in ('-x', '--exclude'): - exclude = 1 - allran = 0 - elif o in ('-e', '--expected'): - expected = 1 - allran = 0 + exclude = True + elif o in ('-s', '--single'): + single = True elif o in ('-r', '--randomize'): - randomize = 1 + randomize = True + elif o in ('-f', '--fromfile'): + fromfile = a elif o in ('-l', '--findleaks'): - findleaks = 1 - elif o in ('-m', '--memo'): - memo = a + findleaks = True + elif o in ('-L', '--runleaks'): + runleaks = True + elif o in ('-t', '--threshold'): + import gc + gc.set_threshold(int(a)) + elif o in ('-T', '--coverage'): + trace = True + elif o in ('-D', '--coverdir'): + coverdir = os.path.join(os.getcwd(), a) + elif o in ('-N', '--nocoverdir'): + coverdir = None + elif o in ('-R', '--huntrleaks'): + huntrleaks = a.split(':') + if len(huntrleaks) != 3: + print a, huntrleaks + usage(2, '-R takes three colon-separated arguments') + if len(huntrleaks[0]) == 0: + huntrleaks[0] = 5 + else: + huntrleaks[0] = int(huntrleaks[0]) + if len(huntrleaks[1]) == 0: + huntrleaks[1] = 4 + else: + 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: @@ -292,6 +286,8 @@ use_resources.append(r) if generate and verbose: usage(2, "-g and -v don't go together!") + if single and fromfile: + usage(2, "-s and -f don't go together!") good = [] bad = [] @@ -303,7 +299,7 @@ import gc except ImportError: print 'No GC available, disabling findleaks.' - findleaks = 0 + findleaks = False else: # Uncomment the line below to report garbage that is not # freeable by reference counting alone. By default only @@ -311,60 +307,71 @@ #gc.set_debug(gc.DEBUG_SAVEALL) found_garbage = [] - strip_py(args) + if single: + from tempfile import gettempdir + filename = os.path.join(gettempdir(), 'pynexttest') + try: + fp = open(filename, 'r') + next = fp.read().strip() + tests = [next] + fp.close() + except IOError: + pass + if fromfile: + tests = [] + fp = open(fromfile) + for line in fp: + guts = line.split() # assuming no test has whitespace in its name + if guts and not guts[0].startswith('#'): + tests.extend(guts) + fp.close() + + # Strip .py extensions. + if args: + args = map(removepy, args) + if tests: + tests = map(removepy, tests) + stdtests = STDTESTS[:] nottests = NOTTESTS[:] if exclude: for arg in args: if arg in stdtests: stdtests.remove(arg) - allran = 0 nottests[:0] = args args = [] - - clean_sys_path() - - if args: - allran = 0 - tests = tests or args or findalltests(testdir, stdtests, nottests,all=all) - testdirs = findtestdirs(all) - + tests = tests or args or findtests(testdir, stdtests, nottests) + if single: + tests = tests[:1] if randomize: random.shuffle(tests) + if trace: + import trace + tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix], + trace=False, count=True) test_support.verbose = verbose # Tell tests to be moderately quiet test_support.use_resources = use_resources save_modules = sys.modules.keys() - - saved_sys_path = sys.path - skips = _Expected(_skips) - failures = _Expected(_failures) for test in tests: - if expected and (test in skips or test in failures): - continue - test_basename = test - consider_dirs = testdirs - if test_basename in oneonly: - consider_dirs = testdirs[:1] - for testdir in consider_dirs: - test = test_basename - if not os.path.isfile(os.path.join(testdir,test+'.py')): - continue - - test_spec = "[%s]%s" % (testdir,test) - - if not quiet: - print test - sys.stdout.flush() - - sys.path.insert(0,testdir) - - ok = runtest(test, generate, verbose, quiet, testdir) - - sys.path = saved_sys_path - -# test = test_spec - + if not quiet: + print test + sys.stdout.flush() + if trace: + # If we're tracing code coverage, then we don't exit with status + # if on a false return value from main. + tracer.runctx('runtest(test, generate, verbose, quiet, testdir)', + globals=globals(), locals=vars()) + else: + try: + ok = runtest(test, generate, verbose, quiet, testdir, + huntrleaks) + except KeyboardInterrupt: + # print a newline separate from the ^C + print + break + except: + raise if ok > 0: good.append(test) elif ok == 0: @@ -373,20 +380,19 @@ skipped.append(test) if ok == -2: resource_denieds.append(test) - if findleaks: - gc.collect() - if gc.garbage: - print "Warning: test created", len(gc.garbage), - print "uncollectable object(s)." - # move the uncollectable objects somewhere so we don't see - # them again - found_garbage.extend(gc.garbage) - del gc.garbage[:] - # Unload the newly imported modules (best effort finalization) - for module in sys.modules.keys(): - if module not in save_modules and ( - module.startswith("test.") or module.startswith('test_')): - test_support.unload(module) + if findleaks: + gc.collect() + if gc.garbage: + print "Warning: test created", len(gc.garbage), + print "uncollectable object(s)." + # move the uncollectable objects somewhere so we don't see + # them again + found_garbage.extend(gc.garbage) + del gc.garbage[:] + # Unload the newly imported modules (best effort finalization) + for module in sys.modules.keys(): + if module not in save_modules and module.startswith("test."): + test_support.unload(module) # The lists won't be sorted if running with -r good.sort() @@ -398,22 +404,69 @@ print "All", print count(len(good), "test"), "OK." if verbose: - print "CAUTION: stdout isn't compared in verbose mode: a test" - print "that passes in verbose mode may fail without it." - surprises = 0 + print "CAUTION: stdout isn't compared in verbose mode:" + print "a test that passes in verbose mode may fail without it." + if bad: + print count(len(bad), "test"), "failed:" + printlist(bad) if skipped and not quiet: print count(len(skipped), "test"), "skipped:" - surprises += countsurprises(skips, skipped, 'skip', 'ran', allran, resource_denieds) - if bad: - print count(len(bad), "test"), "failed:" - surprises += countsurprises(failures, bad, 'fail', 'passed', allran, resource_denieds) + printlist(skipped) - if memo: - savememo(memo,good,bad,skipped) + e = _ExpectedSkips() + plat = sys.platform + if e.isvalid(): + surprise = set(skipped) - e.getexpected() - set(resource_denieds) + if surprise: + print count(len(surprise), "skip"), \ + "unexpected on", plat + ":" + printlist(surprise) + else: + print "Those skips are all expected on", plat + "." + else: + print "Ask someone to teach regrtest.py about which tests are" + print "expected to get skipped on", plat + "." - return surprises > 0 + if verbose2 and bad: + print "Re-running failed tests in verbose mode" + for test in bad: + print "Re-running test %r in verbose mode" % test + sys.stdout.flush() + try: + test_support.verbose = 1 + ok = runtest(test, generate, 1, quiet, testdir, + huntrleaks) + except KeyboardInterrupt: + # print a newline separate from the ^C + print + break + except: + raise + if single: + alltests = findtests(testdir, stdtests, nottests) + for i in range(len(alltests)): + if tests[0] == alltests[i]: + if i == len(alltests) - 1: + os.unlink(filename) + else: + fp = open(filename, 'w') + fp.write(alltests[i+1] + '\n') + fp.close() + break + else: + os.unlink(filename) + if trace: + r = tracer.results() + r.write_results(show_missing=True, summary=True, coverdir=coverdir) + + if runleaks: + os.system("leaks %d" % os.getpid()) + + sys.exit(len(bad) > 0) + + STDTESTS = [ 'test_grammar', 'test_opcodes', @@ -421,12 +474,13 @@ 'test_builtin', 'test_exceptions', 'test_types', + 'test_unittest', + 'test_doctest', + 'test_doctest2', ] NOTTESTS = [ 'test_support', - 'test_b1', - 'test_b2', 'test_future1', 'test_future2', 'test_future3', @@ -445,30 +499,55 @@ tests.sort() return stdtests + tests -def runtest(test, generate, verbose, quiet, testdir = None): +def runtest(test, generate, verbose, quiet, testdir=None, huntrleaks=False): """Run a single test. + test -- the name of the test generate -- if true, generate output, instead of running the test - and comparing it to a previously created output file + and comparing it to a previously created output file verbose -- if true, print more messages quiet -- if true, don't print 'skipped' messages (probably redundant) testdir -- test directory + huntrleaks -- run multiple times to test for leaks; requires a debug + build; a triple corresponding to -R's three arguments + Return: + -2 test skipped because resource denied + -1 test skipped for some other reason + 0 test failed + 1 test passed """ + + try: + return runtest_inner(test, generate, verbose, quiet, testdir, + huntrleaks) + finally: + cleanup_test_droppings(test, verbose) + +def runtest_inner(test, generate, verbose, quiet, + testdir=None, huntrleaks=False): test_support.unload(test) - if not testdir: testdir = findtestdir() + if not testdir: + testdir = findtestdir() outputdir = os.path.join(testdir, "output") outputfile = os.path.join(outputdir, test) if verbose: cfp = None else: - cfp = StringIO.StringIO() + cfp = cStringIO.StringIO() + try: save_stdout = sys.stdout try: if cfp: sys.stdout = cfp print test # Output file starts with test name - the_module = __import__(test, globals(), locals(), []) + if test.startswith('test.'): + abstest = test + else: + # Always import it from the test package + abstest = 'test.' + test + the_package = __import__(abstest, globals(), locals(), []) + the_module = getattr(the_package, test) # Most tests run to completion simply as a side-effect of # being imported. For the benefit of tests that can't run # that way (like test_threaded_import), explicitly invoke @@ -476,6 +555,8 @@ indirect_test = getattr(the_module, "test_main", None) if indirect_test is not None: indirect_test() + if huntrleaks: + dash_R(the_module, test, indirect_test, huntrleaks) finally: sys.stdout = save_stdout except test_support.ResourceDenied, msg: @@ -527,7 +608,7 @@ fp.close() else: expected = test + "\n" - if output == expected: + if output == expected or huntrleaks: return 1 print "test", test, "produced unexpected output:" sys.stdout.flush() @@ -535,6 +616,108 @@ sys.stdout.flush() return 0 +def cleanup_test_droppings(testname, verbose): + import shutil + + # Try to clean up junk commonly left behind. While tests shouldn't leave + # any files or directories behind, when a test fails that can be tedious + # for it to arrange. The consequences can be especially nasty on Windows, + # since if a test leaves a file open, it cannot be deleted by name (while + # there's nothing we can do about that here either, we can display the + # name of the offending test, which is a real help). + for name in (test_support.TESTFN, + "db_home", + ): + if not os.path.exists(name): + continue + + if os.path.isdir(name): + kind, nuker = "directory", shutil.rmtree + elif os.path.isfile(name): + kind, nuker = "file", os.unlink + else: + raise SystemError("os.path says %r exists but is neither " + "directory nor file" % name) + + if verbose: + print "%r left behind %s %r" % (testname, kind, name) + try: + nuker(name) + except Exception, msg: + print >> sys.stderr, ("%r left behind %s %r and it couldn't be " + "removed: %s" % (testname, kind, name, msg)) + +def dash_R(the_module, test, indirect_test, huntrleaks): + # This code is hackish and inelegant, but it seems to do the job. + import copy_reg + + if not hasattr(sys, 'gettotalrefcount'): + raise Exception("Tracking reference leaks requires a debug build " + "of Python") + + # Save current values for dash_R_cleanup() to restore. + fs = warnings.filters[:] + ps = copy_reg.dispatch_table.copy() + pic = sys.path_importer_cache.copy() + + if indirect_test: + def run_the_test(): + indirect_test() + else: + def run_the_test(): + reload(the_module) + + deltas = [] + nwarmup, ntracked, fname = huntrleaks + repcount = nwarmup + ntracked + print >> sys.stderr, "beginning", repcount, "repetitions" + print >> sys.stderr, ("1234567890"*(repcount//10 + 1))[:repcount] + dash_R_cleanup(fs, ps, pic) + for i in range(repcount): + rc = sys.gettotalrefcount() + run_the_test() + sys.stderr.write('.') + dash_R_cleanup(fs, ps, pic) + if i >= nwarmup: + deltas.append(sys.gettotalrefcount() - rc - 2) + print >> sys.stderr + if any(deltas): + print >> sys.stderr, test, 'leaked', deltas, 'references' + refrep = open(fname, "a") + print >> refrep, test, 'leaked', deltas, 'references' + refrep.close() + +def dash_R_cleanup(fs, ps, pic): + import gc, copy_reg + import _strptime, linecache, dircache + import urlparse, urllib, urllib2, mimetypes, doctest + import struct, filecmp + from distutils.dir_util import _path_created + + # Restore some original values. + warnings.filters[:] = fs + copy_reg.dispatch_table.clear() + copy_reg.dispatch_table.update(ps) + sys.path_importer_cache.clear() + sys.path_importer_cache.update(pic) + + # Clear assorted module caches. + _path_created.clear() + re.purge() + _strptime._regex_cache.clear() + urlparse.clear_cache() + urllib.urlcleanup() + urllib2.install_opener(None) + dircache.reset() + linecache.clearcache() + mimetypes._default_mime_types() + struct._cache.clear() + filecmp._cache.clear() + doctest.master = None + + # Collect cyclic trash. + gc.collect() + def reportdiff(expected, output): import difflib print "*" * 70 @@ -585,6 +768,11 @@ testdir = os.path.dirname(file) or os.curdir return testdir +def removepy(name): + if name.endswith(os.extsep + "py"): + name = name[:-3] + return name + def count(n, word): if n == 1: return "%d %s" % (n, word) @@ -592,52 +780,40 @@ return "%d %ss" % (n, word) def printlist(x, width=70, indent=4): - """Print the elements of a sequence to stdout. + """Print the elements of iterable x to stdout. Optional arg width (default 70) is the maximum line length. Optional arg indent (default 4) is the number of blanks with which to begin each line. """ - line = ' ' * indent - x = list(x) - x.sort() - for one in map(str, x): - w = len(line) + len(one) - if line[-1:] == ' ': - pad = '' - else: - pad = ' ' - w += 1 - if w > width: - print line - line = ' ' * indent + one - else: - line += pad + one - if len(line) > indent: - print line + from textwrap import fill + blanks = ' ' * indent + print fill(' '.join(map(str, x)), width, + initial_indent=blanks, subsequent_indent=blanks) -def countsurprises(expected, actual, action, antiaction, allran, resource_denieds): - """returns the number of items in actual that aren't in expected.""" - printlist(actual) - if not expected.isvalid(): - print "Ask someone to teach regrtest.py about which tests are" - print "expected to %s on %s." % (action, sys.platform) - return 1#Surprising not to know what to expect.... - good_surprise = expected.getexpected() - set(actual) - if allran and good_surprise: - print count(len(good_surprise), 'test'), antiaction, 'unexpectedly:' - printlist(good_surprise) - bad_surprise = set(actual) - expected.getexpected() - set(resource_denieds) - if bad_surprise: - print count(len(bad_surprise), action), "unexpected:" - printlist(bad_surprise) - return len(bad_surprise) +# Map sys.platform to a string containing the basenames of tests +# expected to be skipped on that platform. +# +# Special cases: +# test_pep277 +# The _ExpectedSkips constructor adds this to the set of expected +# skips if not os.path.supports_unicode_filenames. +# test_socket_ssl +# Controlled by test_socket_ssl.skip_expected. Requires the network +# resource, and a socket module with ssl support. +# test_timeout +# Controlled by test_timeout.skip_expected. Requires the network +# resource and a socket module. -_skips = { +_expectations = { 'win32': """ + test__locale + test_applesingle test_al + test_bsddb185 + test_bsddb3 test_cd test_cl test_commands @@ -645,51 +821,59 @@ test_curses test_dbm test_dl - test_email_codecs test_fcntl test_fork1 test_gdbm test_gl test_grp test_imgfile + test_ioctl test_largefile test_linuxaudiodev test_mhlib test_nis test_openpty + test_ossaudiodev test_poll + test_posix test_pty test_pwd + test_resource test_signal - test_socket_ssl - test_socketserver test_sunaudiodev + test_threadsignals test_timing + test_wait3 + test_wait4 """, 'linux2': """ test_al + test_applesingle + test_bsddb185 test_cd test_cl test_curses test_dl - test_email_codecs test_gl test_imgfile test_largefile + test_linuxaudiodev test_nis test_ntpath - test_socket_ssl - test_socketserver + test_ossaudiodev + test_sqlite + test_startfile test_sunaudiodev - test_unicode_file - test_winreg - test_winsound """, - 'mac': + 'mac': """ test_al + test_atexit test_bsddb + test_bsddb185 + test_bsddb3 + test_bz2 test_cd test_cl test_commands @@ -697,11 +881,11 @@ test_curses test_dbm test_dl - test_email_codecs test_fcntl test_fork1 test_gl test_grp + test_ioctl test_imgfile test_largefile test_linuxaudiodev @@ -710,28 +894,31 @@ test_nis test_ntpath test_openpty + test_ossaudiodev test_poll + test_popen test_popen2 + test_posix test_pty test_pwd + test_resource test_signal - test_socket_ssl - test_socketserver + test_sqlite + test_startfile test_sunaudiodev test_sundry + test_tarfile test_timing - test_unicode_file - test_winreg - test_winsound """, 'unixware7': """ test_al + test_applesingle test_bsddb + test_bsddb185 test_cd test_cl test_dl - test_email_codecs test_gl test_imgfile test_largefile @@ -742,21 +929,20 @@ test_openpty test_pyexpat test_sax - test_socketserver + test_startfile + test_sqlite test_sunaudiodev test_sundry - test_unicode_file - test_winreg - test_winsound """, 'openunix8': """ test_al + test_applesingle test_bsddb + test_bsddb185 test_cd test_cl test_dl - test_email_codecs test_gl test_imgfile test_largefile @@ -767,22 +953,21 @@ test_openpty test_pyexpat test_sax - test_socketserver + test_sqlite + test_startfile test_sunaudiodev test_sundry - test_unicode_file - test_winreg - test_winsound """, 'sco_sv3': """ test_al + test_applesingle test_asynchat test_bsddb + test_bsddb185 test_cd test_cl test_dl - test_email_codecs test_fork1 test_gettext test_gl @@ -797,29 +982,30 @@ test_pyexpat test_queue test_sax - test_socketserver + test_sqlite + test_startfile test_sunaudiodev test_sundry test_thread test_threaded_import test_threadedtempfile test_threading - test_unicode_file - test_winreg - test_winsound """, 'riscos': """ test_al + test_applesingle test_asynchat + test_atexit test_bsddb + test_bsddb185 + test_bsddb3 test_cd test_cl test_commands test_crypt test_dbm test_dl - test_email_codecs test_fcntl test_fork1 test_gdbm @@ -837,9 +1023,9 @@ test_popen2 test_pty test_pwd - test_socket_ssl - test_socketserver test_strop + test_sqlite + test_startfile test_sunaudiodev test_sundry test_thread @@ -847,59 +1033,58 @@ test_threadedtempfile test_threading test_timing - test_unicode_file - test_winreg - test_winsound """, 'darwin': """ + test__locale test_al + test_bsddb + test_bsddb3 test_cd test_cl test_curses - test_dl - test_email_codecs test_gdbm test_gl test_imgfile test_largefile + test_linuxaudiodev test_locale - test_linuxaudiodev test_minidom test_nis test_ntpath + test_ossaudiodev test_poll - test_socket_ssl - test_socketserver + test_sqlite + test_startfile test_sunaudiodev - test_unicode_file - test_winreg - test_winsound """, 'sunos5': """ test_al + test_applesingle test_bsddb + test_bsddb185 test_cd test_cl test_curses test_dbm - test_email_codecs test_gdbm test_gl test_gzip test_imgfile test_linuxaudiodev - test_mpz test_openpty - test_socketserver + test_sqlite + test_startfile test_zipfile test_zlib """, 'hp-ux11': """ test_al + test_applesingle test_bsddb + test_bsddb185 test_cd test_cl test_curses @@ -917,159 +1102,259 @@ test_openpty test_pyexpat test_sax - test_socketserver + test_sqlite + test_startfile test_sunaudiodev test_zipfile test_zlib """, - 'freebsd4': + 'atheos': """ test_al + test_applesingle + test_bsddb185 test_cd test_cl test_curses - test_email_codecs + test_dl test_gdbm test_gl test_imgfile + test_largefile test_linuxaudiodev test_locale - test_minidom + test_mhlib + test_mmap test_nis - test_pyexpat - test_sax + test_poll + test_popen2 + test_resource + test_sqlite + test_startfile + test_sunaudiodev + """, + 'cygwin': + """ + test_al + test_applesingle + test_bsddb185 + test_bsddb3 + test_cd + test_cl + test_curses + test_dbm + test_gl + test_imgfile + test_ioctl + test_largefile + test_linuxaudiodev + test_locale + test_nis + test_ossaudiodev + test_socketserver + test_sqlite + test_sunaudiodev + """, + 'os2emx': + """ + test_al + test_applesingle + test_audioop + test_bsddb185 + test_bsddb3 + test_cd + test_cl + test_commands + test_curses + test_dl + test_gl + test_imgfile + test_largefile + test_linuxaudiodev + test_mhlib + test_mmap + test_nis + test_openpty + test_ossaudiodev + test_pty + test_resource + test_signal + test_sqlite + test_startfile + test_sunaudiodev + """, + 'freebsd4': + """ + test_aepack + test_al + test_applesingle + test_bsddb + test_bsddb3 + test_cd + test_cl + test_gdbm + test_gl + test_imgfile + test_linuxaudiodev + test_locale + test_macfs + test_macostools + test_nis + test_ossaudiodev + test_pep277 + test_plistlib + test_pty + test_scriptpackages test_socket_ssl test_socketserver + test_sqlite + test_startfile test_sunaudiodev + test_tcl + test_timeout test_unicode_file + test_urllibnet test_winreg test_winsound """, - 'java': + 'aix5': """ test_aepack test_al - test_asynchat - test_audioop + test_applesingle test_bsddb test_bsddb185 test_bsddb3 test_bz2 - test_capi test_cd test_cl - test_codeccallbacks - test_codeop - test_commands - test_crypt - test_csv - test_curses - test_dbm test_dl - test_dummy_thread - test_dummy_threading - test_email_codecs - test_fcntl - test_fork1 test_gdbm - test_getargs2 test_gl - test_grp - test_hotshot - test_imageop + test_gzip test_imgfile - test_import - test_ioctl - test_largefile test_linuxaudiodev + test_macfs + test_macostools + test_nis + test_ossaudiodev + test_sqlite + test_startfile + test_sunaudiodev + test_tcl + test_winreg + test_winsound + test_zipimport + test_zlib + """, + 'openbsd3': + """ + test_aepack + test_al + test_applesingle + test_bsddb + test_bsddb3 + test_cd + test_cl + test_ctypes + test_dl + test_gdbm + test_gl + test_imgfile + test_linuxaudiodev test_locale - test_longexp test_macfs test_macostools - test_mmap - test_mpz test_nis test_normalization - test_openpty test_ossaudiodev - test_parser + test_pep277 test_plistlib - test_poll - test_pty - test_pwd - test_pyexpat - test_regex - test_resource - test_rgbimg - test_robotparser - test_rotor test_scriptpackages - test_signal - test_socket_ssl - test_socketserver - test_stringprep - test_strop - test_strptime + test_tcl + test_sqlite + test_startfile test_sunaudiodev - test_sundry - test_symtable - test_timeout - test_timing test_unicode_file - test_unicodedata - test_wave test_winreg test_winsound + """, + 'netbsd3': """ + test_aepack + test_al + test_applesingle + test_bsddb + test_bsddb185 + test_bsddb3 + test_cd + test_cl + test_ctypes + test_curses + test_dl + test_gdbm + test_gl + test_imgfile + test_linuxaudiodev + test_locale + test_macfs + test_macostools + test_nis + test_ossaudiodev + test_pep277 + test_sqlite + test_startfile + test_sunaudiodev + test_tcl + test_unicode_file + test_winreg + test_winsound + """, } -if test_support.is_jython: - if test_support.underlying_system.startswith('win'): - _skips['java'] += 'test_mhlib' - else: - _skips['java'] += 'test_pep277' +_expectations['freebsd5'] = _expectations['freebsd4'] +_expectations['freebsd6'] = _expectations['freebsd4'] +_expectations['freebsd7'] = _expectations['freebsd4'] -_failures = { - 'java': - ''' - test_ast - test_class - test_copy - test_dis - test_descrtut - test_eof - test_frozen - test_gc - test_hexoct - test_iterlen - test_marshal - test_pep263 - test_pkgimport - test_profilehooks - test_pyclbr - test_quopri - test_random - test_softspace - test_syntax - test_trace - test_ucn - test_unicode - test_zipimport - ''', -} +class _ExpectedSkips: + def __init__(self): + import os.path + from test import test_socket_ssl + from test import test_timeout -class _Expected: - def __init__(self, expect_dict): - self.valid = 0 - platform = sys.platform - if platform[:4] == 'java': - platform = 'java' - if expect_dict.has_key(platform): - s = expect_dict[platform] + self.valid = False + if sys.platform in _expectations: + s = _expectations[sys.platform] self.expected = set(s.split()) - self.valid = 1 + if not os.path.supports_unicode_filenames: + self.expected.add('test_pep277') + + if test_socket_ssl.skip_expected: + self.expected.add('test_socket_ssl') + + if test_timeout.skip_expected: + self.expected.add('test_timeout') + + if sys.maxint == 9223372036854775807L: + self.expected.add('test_rgbimg') + self.expected.add('test_imageop') + + if not sys.platform in ("mac", "darwin"): + MAC_ONLY = ["test_macostools", "test_macfs", "test_aepack", + "test_plistlib", "test_scriptpackages"] + for skip in MAC_ONLY: + self.expected.add(skip) + + if sys.platform != "win32": + WIN_ONLY = ["test_unicode_file", "test_winreg", + "test_winsound"] + for skip in WIN_ONLY: + self.expected.add(skip) + + self.valid = True + def isvalid(self): - "Return true iff _Expected knows about the current platform." + "Return true iff _ExpectedSkips knows about the current platform." return self.valid def getexpected(self): @@ -1081,8 +1366,19 @@ assert self.isvalid() return self.expected - def __contains__(self, key): - return key in self.expected - if __name__ == '__main__': - sys.exit(main()) + # Remove regrtest.py's own directory from the module search path. This + # prevents relative imports from working, and relative imports will screw + # up the testing framework. E.g. if both test.test_support and + # test_support are imported, they will not contain the same globals, and + # much of the testing framework relies on the globals in the + # test.test_support module. + mydir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0]))) + i = pathlen = len(sys.path) + while i >= 0: + i -= 1 + if os.path.abspath(os.path.normpath(sys.path[i])) == mydir: + del sys.path[i] + if len(sys.path) == pathlen: + print 'Could not find %r in sys.path to remove it' % mydir + main() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2008-06-25 20:48:30
|
Revision: 4772 http://jython.svn.sourceforge.net/jython/?rev=4772&view=rev Author: pjenvey Date: 2008-06-25 13:48:27 -0700 (Wed, 25 Jun 2008) Log Message: ----------- re-integrate jython specifics: mostly just -e support and java platform test defines Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-25 20:46:49 UTC (rev 4771) +++ branches/asm/Lib/test/regrtest.py 2008-06-25 20:48:27 UTC (rev 4772) @@ -26,6 +26,7 @@ -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 +-e: expected -- run only tests that are expected to run and pass 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. @@ -179,7 +180,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, findleaks=False, use_resources=None, trace=False, coverdir='coverage', - runleaks=False, huntrleaks=False, verbose2=False): + runleaks=False, huntrleaks=False, verbose2=False, expected=False): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -204,17 +205,19 @@ test_support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:', + opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:e', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'verbose2', 'memlimit=', + 'expected' ]) except getopt.error, msg: usage(2, msg) # Defaults + allran = True if use_resources is None: use_resources = [] for o, a in opts: @@ -231,6 +234,10 @@ generate = True elif o in ('-x', '--exclude'): exclude = True + allran = False + elif o in ('-e', '--expected'): + expected = True + allran = False elif o in ('-s', '--single'): single = True elif o in ('-r', '--randomize'): @@ -296,6 +303,8 @@ if findleaks: try: + if test_support.is_jython: + raise ImportError() import gc except ImportError: print 'No GC available, disabling findleaks.' @@ -330,6 +339,7 @@ # Strip .py extensions. if args: args = map(removepy, args) + allran = False if tests: tests = map(removepy, tests) @@ -353,7 +363,11 @@ test_support.verbose = verbose # Tell tests to be moderately quiet test_support.use_resources = use_resources save_modules = sys.modules.keys() + skips = _ExpectedSkips() + failures = _ExpectedFailures() for test in tests: + if expected and (test in skips or test in failures): + continue if not quiet: print test sys.stdout.flush() @@ -406,27 +420,14 @@ if verbose: print "CAUTION: stdout isn't compared in verbose mode:" print "a test that passes in verbose mode may fail without it." + surprises = 0 + if skipped and not quiet: + print count(len(skipped), "test"), "skipped:" + surprises += countsurprises(skips, skipped, 'skip', 'ran', allran, resource_denieds) if bad: print count(len(bad), "test"), "failed:" - printlist(bad) - if skipped and not quiet: - print count(len(skipped), "test"), "skipped:" - printlist(skipped) + surprises += countsurprises(failures, bad, 'fail', 'passed', allran, resource_denieds) - e = _ExpectedSkips() - plat = sys.platform - if e.isvalid(): - surprise = set(skipped) - e.getexpected() - set(resource_denieds) - if surprise: - print count(len(surprise), "skip"), \ - "unexpected on", plat + ":" - printlist(surprise) - else: - print "Those skips are all expected on", plat + "." - else: - print "Ask someone to teach regrtest.py about which tests are" - print "expected to get skipped on", plat + "." - if verbose2 and bad: print "Re-running failed tests in verbose mode" for test in bad: @@ -464,7 +465,7 @@ if runleaks: os.system("leaks %d" % os.getpid()) - sys.exit(len(bad) > 0) + sys.exit(surprises > 0) STDTESTS = [ @@ -610,7 +611,6 @@ expected = test + "\n" if output == expected or huntrleaks: return 1 - print "test", test, "produced unexpected output:" sys.stdout.flush() reportdiff(expected, output) sys.stdout.flush() @@ -789,9 +789,26 @@ from textwrap import fill blanks = ' ' * indent - print fill(' '.join(map(str, x)), width, + print fill(' '.join(map(str, sorted(x))), width, initial_indent=blanks, subsequent_indent=blanks) +def countsurprises(expected, actual, action, antiaction, allran, resource_denieds): + """returns the number of items in actual that aren't in expected.""" + printlist(actual) + if not expected.isvalid(): + print "Ask someone to teach regrtest.py about which tests are" + print "expected to %s on %s." % (action, sys.platform) + return 1#Surprising not to know what to expect.... + good_surprise = expected.getexpected() - set(actual) + if allran and good_surprise: + print count(len(good_surprise), 'test'), antiaction, 'unexpectedly:' + printlist(good_surprise) + bad_surprise = set(actual) - expected.getexpected() - set(resource_denieds) + if bad_surprise: + print count(len(bad_surprise), action), "unexpected:" + printlist(bad_surprise) + return len(bad_surprise) + # Map sys.platform to a string containing the basenames of tests # expected to be skipped on that platform. # @@ -1310,11 +1327,120 @@ test_winreg test_winsound """, + 'java': + """ + test_aepack + test_al + test_asynchat + test_audioop + test_bsddb + test_bsddb185 + test_bsddb3 + test_bz2 + test_capi + test_cd + test_cl + test_codeccallbacks + test_codeop + test_commands + test_crypt + test_csv + test_curses + test_dbm + test_dl + test_dummy_thread + test_dummy_threading + test_email_codecs + test_fcntl + test_fork1 + test_gdbm + test_getargs2 + test_gl + test_grp + test_hotshot + test_imageop + test_imgfile + test_import + test_ioctl + test_largefile + test_linuxaudiodev + test_locale + test_longexp + test_macfs + test_macostools + test_mmap + test_mpz + test_nis + test_normalization + test_openpty + test_ossaudiodev + test_parser + test_plistlib + test_poll + test_pty + test_pwd + test_pyexpat + test_regex + test_resource + test_rgbimg + test_robotparser + test_rotor + test_scriptpackages + test_signal + test_socket_ssl + test_socketserver + test_stringprep + test_strop + test_strptime + test_sunaudiodev + test_sundry + test_symtable + test_timeout + test_timing + test_unicode_file + test_unicodedata + test_wave + test_winreg + test_winsound + """ } _expectations['freebsd5'] = _expectations['freebsd4'] _expectations['freebsd6'] = _expectations['freebsd4'] _expectations['freebsd7'] = _expectations['freebsd4'] +_failures = { + 'java': + """ + test_ast + test_class + test_copy + test_dis + test_descrtut + test_eof + test_frozen + test_gc + test_hexoct + test_iterlen + test_marshal + test_pep263 + test_pkgimport + test_profilehooks + test_pyclbr + test_quopri + test_random + test_softspace + test_syntax + test_trace + test_ucn + test_unicode + test_zipimport + """, +} + +_platform = sys.platform +if _platform[:4] == 'java': + _platform = 'java' + class _ExpectedSkips: def __init__(self): import os.path @@ -1322,8 +1448,8 @@ from test import test_timeout self.valid = False - if sys.platform in _expectations: - s = _expectations[sys.platform] + if _platform in _expectations: + s = _expectations[_platform] self.expected = set(s.split()) if not os.path.supports_unicode_filenames: @@ -1366,6 +1492,17 @@ assert self.isvalid() return self.expected + def __contains__(self, key): + return key in self.expected + +class _ExpectedFailures(_ExpectedSkips): + def __init__(self): + self.valid = False + if _platform in _failures: + s = _failures[_platform] + self.expected = set(s.split()) + self.valid = True + if __name__ == '__main__': # Remove regrtest.py's own directory from the module search path. This # prevents relative imports from working, and relative imports will screw This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-06-25 23:08:36
|
Revision: 4774 http://jython.svn.sourceforge.net/jython/?rev=4774&view=rev Author: fwierzbicki Date: 2008-06-25 16:08:30 -0700 (Wed, 25 Jun 2008) Log Message: ----------- Can't live without -m. Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-25 22:46:10 UTC (rev 4773) +++ branches/asm/Lib/test/regrtest.py 2008-06-25 23:08:30 UTC (rev 4774) @@ -15,6 +15,7 @@ -x: exclude -- arguments are tests to *exclude* -s: single -- run only a single test (see below) -r: random -- randomize test execution order +-m: memo -- save results to file -f: fromfile -- read names of tests to run from a file (see below) -l: findleaks -- if GC is available detect tests that leak memory -u: use -- specify which special resource intensive tests to run @@ -180,7 +181,7 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, exclude=False, single=False, randomize=False, fromfile=None, findleaks=False, use_resources=None, trace=False, coverdir='coverage', - runleaks=False, huntrleaks=False, verbose2=False, expected=False): + runleaks=False, huntrleaks=False, verbose2=False, expected=False, memo=None): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -205,13 +206,13 @@ test_support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:e', + opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:em:', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'verbose2', 'memlimit=', - 'expected' + 'expected', 'memo' ]) except getopt.error, msg: usage(2, msg) @@ -248,6 +249,8 @@ findleaks = True elif o in ('-L', '--runleaks'): runleaks = True + elif o in ('-m', '--memo'): + memo = a elif o in ('-t', '--threshold'): import gc gc.set_threshold(int(a)) @@ -465,6 +468,9 @@ if runleaks: os.system("leaks %d" % os.getpid()) + if memo: + savememo(memo,good,bad,skipped) + sys.exit(surprises > 0) @@ -1503,6 +1509,17 @@ self.expected = set(s.split()) self.valid = True +def savememo(memo,good,bad,skipped): + f = open(memo,'w') + try: + for n,l in [('good',good),('bad',bad),('skipped',skipped)]: + print >>f,"%s = [" % n + for x in l: + print >>f," %r," % x + print >>f," ]" + finally: + f.close() + if __name__ == '__main__': # Remove regrtest.py's own directory from the module search path. This # prevents relative imports from working, and relative imports will screw This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2008-06-26 00:12:37
|
Revision: 4777 http://jython.svn.sourceforge.net/jython/?rev=4777&view=rev Author: pjenvey Date: 2008-06-25 17:12:35 -0700 (Wed, 25 Jun 2008) Log Message: ----------- skip a number of tests we won't pass anytime soon. mark most of the cjkencodings tests and xml_etree as perm failures for now. re-enable test_unicode as it's close to passing Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-26 00:07:44 UTC (rev 4776) +++ branches/asm/Lib/test/regrtest.py 2008-06-26 00:12:35 UTC (rev 4777) @@ -1335,14 +1335,17 @@ """, 'java': """ + test__locale test_aepack test_al + test_applesingle test_asynchat test_audioop test_bsddb test_bsddb185 test_bsddb3 test_bz2 + test_cProfile test_capi test_cd test_cl @@ -1351,6 +1354,7 @@ test_commands test_crypt test_csv + test_ctypes test_curses test_dbm test_dl @@ -1395,16 +1399,24 @@ test_signal test_socket_ssl test_socketserver + test_sqlite + test_startfile test_stringprep test_strop test_strptime test_sunaudiodev test_sundry + test_structmembers test_symtable + test_tcl + test_threadsignals test_timeout test_timing test_unicode_file test_unicodedata + test_wait3 + test_wait4 + test_xml_etree_c test_wave test_winreg test_winsound @@ -1419,6 +1431,16 @@ """ test_ast test_class + test_codecencodings_cn + test_codecencodings_hk + test_codecencodings_jp + test_codecencodings_kr + test_codecencodings_tw + test_codecmaps_cn + test_codecmaps_hk + test_codecmaps_jp + test_codecmaps_kr + test_codecmaps_tw test_copy test_dis test_descrtut @@ -1438,7 +1460,7 @@ test_syntax test_trace test_ucn - test_unicode + test_xml_etree test_zipimport """, } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-06-26 17:11:58
|
Revision: 4782 http://jython.svn.sourceforge.net/jython/?rev=4782&view=rev Author: fwierzbicki Date: 2008-06-26 10:11:56 -0700 (Thu, 26 Jun 2008) Log Message: ----------- hexoct is passing. Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-06-26 01:47:39 UTC (rev 4781) +++ branches/asm/Lib/test/regrtest.py 2008-06-26 17:11:56 UTC (rev 4782) @@ -1447,7 +1447,6 @@ test_eof test_frozen test_gc - test_hexoct test_iterlen test_marshal test_pep263 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pj...@us...> - 2008-07-11 19:37:23
|
Revision: 4891 http://jython.svn.sourceforge.net/jython/?rev=4891&view=rev Author: pjenvey Date: 2008-07-11 12:37:19 -0700 (Fri, 11 Jul 2008) Log Message: ----------- test_pep263 passes now Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-07-11 14:05:13 UTC (rev 4890) +++ branches/asm/Lib/test/regrtest.py 2008-07-11 19:37:19 UTC (rev 4891) @@ -1489,7 +1489,6 @@ test_gc test_iterlen test_marshal - test_pep263 test_pkgimport test_profilehooks test_pyclbr This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2008-07-12 13:51:08
|
Revision: 4905 http://jython.svn.sourceforge.net/jython/?rev=4905&view=rev Author: zyasoft Date: 2008-07-12 06:51:06 -0700 (Sat, 12 Jul 2008) Log Message: ----------- Removed tests not relevant to Jython around CPython code compilation Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-07-12 13:50:19 UTC (rev 4904) +++ branches/asm/Lib/test/regrtest.py 2008-07-12 13:51:06 UTC (rev 4905) @@ -1389,6 +1389,7 @@ test_capi test_cd test_cl + test_code test_codeccallbacks test_codeop test_commands @@ -1451,6 +1452,7 @@ test_threadsignals test_timeout test_timing + test_transformer test_unicode_file test_unicodedata test_wait3 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2008-07-14 19:26:04
|
Revision: 4932 http://jython.svn.sourceforge.net/jython/?rev=4932&view=rev Author: fwierzbicki Date: 2008-07-14 12:25:59 -0700 (Mon, 14 Jul 2008) Log Message: ----------- unbreak --memo again :) Modified Paths: -------------- branches/asm/Lib/test/regrtest.py Modified: branches/asm/Lib/test/regrtest.py =================================================================== --- branches/asm/Lib/test/regrtest.py 2008-07-14 19:25:31 UTC (rev 4931) +++ branches/asm/Lib/test/regrtest.py 2008-07-14 19:25:59 UTC (rev 4932) @@ -209,7 +209,7 @@ test_support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:emj:', + opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsrf:lu:t:TD:NLR:wM:em:j:', ['help', 'verbose', 'quiet', 'generate', 'exclude', 'single', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |