mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Merged revisions 72658 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72658 | collin.winter | 2009-05-14 16:26:30 -0700 (Thu, 14 May 2009) | 1 line Issue 6024: make regrtest.py promote refleaks to test failures. ........
This commit is contained in:
parent
95d78ec302
commit
a5503d5099
1 changed files with 11 additions and 1 deletions
|
@ -598,6 +598,7 @@ def runtest_inner(test, generate, verbose, quiet, test_times,
|
||||||
else:
|
else:
|
||||||
cfp = io.StringIO() # XXX Should use io.StringIO()
|
cfp = io.StringIO() # XXX Should use io.StringIO()
|
||||||
|
|
||||||
|
refleak = False # True if the test leaked references.
|
||||||
try:
|
try:
|
||||||
save_stdout = sys.stdout
|
save_stdout = sys.stdout
|
||||||
try:
|
try:
|
||||||
|
@ -619,7 +620,7 @@ def runtest_inner(test, generate, verbose, quiet, test_times,
|
||||||
if indirect_test is not None:
|
if indirect_test is not None:
|
||||||
indirect_test()
|
indirect_test()
|
||||||
if huntrleaks:
|
if huntrleaks:
|
||||||
dash_R(the_module, test, indirect_test, huntrleaks)
|
refleak = dash_R(the_module, test, indirect_test, huntrleaks)
|
||||||
test_time = time.time() - start_time
|
test_time = time.time() - start_time
|
||||||
test_times.append((test_time, test))
|
test_times.append((test_time, test))
|
||||||
finally:
|
finally:
|
||||||
|
@ -649,6 +650,8 @@ def runtest_inner(test, generate, verbose, quiet, test_times,
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
if refleak:
|
||||||
|
return 0
|
||||||
if not cfp:
|
if not cfp:
|
||||||
return 1
|
return 1
|
||||||
output = cfp.getvalue()
|
output = cfp.getvalue()
|
||||||
|
@ -698,6 +701,11 @@ def cleanup_test_droppings(testname, verbose):
|
||||||
"removed: %s" % (testname, kind, name, msg)), file=sys.stderr)
|
"removed: %s" % (testname, kind, name, msg)), file=sys.stderr)
|
||||||
|
|
||||||
def dash_R(the_module, test, indirect_test, huntrleaks):
|
def dash_R(the_module, test, indirect_test, huntrleaks):
|
||||||
|
"""Run a test multiple times, looking for reference leaks.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
False if the test didn't leak references; True if we detected refleaks.
|
||||||
|
"""
|
||||||
# This code is hackish and inelegant, but it seems to do the job.
|
# This code is hackish and inelegant, but it seems to do the job.
|
||||||
import copyreg, _abcoll
|
import copyreg, _abcoll
|
||||||
|
|
||||||
|
@ -745,6 +753,8 @@ def dash_R(the_module, test, indirect_test, huntrleaks):
|
||||||
refrep = open(fname, "a")
|
refrep = open(fname, "a")
|
||||||
print(msg, file=refrep)
|
print(msg, file=refrep)
|
||||||
refrep.close()
|
refrep.close()
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def dash_R_cleanup(fs, ps, pic, abcs):
|
def dash_R_cleanup(fs, ps, pic, abcs):
|
||||||
import gc, copyreg
|
import gc, copyreg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue