提交 b538e245 authored 作者: Frederic Bastien's avatar Frederic Bastien

Added an --debug param to autotest.py. This param make the unittest being…

Added an --debug param to autotest.py. This param make the unittest being executed in debug mode. This make that It don't catch exception. This is usefull if you wan to execute autotest.py in a debugger.
上级 cd247b21
import unittest, os, sys, traceback
def test_root_dir():
def test_root_dir(debugmode=False):
suite = None
filenames = os.listdir('.')
for filename in filenames:
......@@ -25,13 +25,31 @@ def test_root_dir():
suite = tests
else:
suite.addTests(tests)
unittest.TextTestRunner(verbosity=1).run(suite)
if debugmode:
suite.debug()
else:
unittest.TextTestRunner(verbosity=1).run(suite)
if __name__ == '__main__':
def printUsage():
print >>sys.stderr, "Bad argument: ",sys.argv
print >>sys.stderr, "only --debug is supported"
sys.exit(1)
debugparam=""
if len(sys.argv)==2:
if sys.argv[1]=="--debug":
debugparam="--debug"
sys.argv.remove(debugparam)
else:
printUsage()
elif len(sys.argv)>2:
printUsage()
try:
os.system('cd gof; %s autotest.py' % sys.argv[1])
os.system('cd gof; %s autotest.py %s' % (sys.argv[1],debugparam))
except IndexError, e:
os.system('cd gof; python autotest.py')
test_root_dir()
os.system('cd gof; python autotest.py %s' % debugparam)
test_root_dir(debugparam!="")
import unittest, os, sys, traceback
if __name__ == '__main__':
def printUsage():
print >>sys.stderr, "Bad argument: ",sys.argv
print >>sys.stderr, "only --debug is supported"
sys.exit(1)
debugparam=""
if len(sys.argv)==2:
if sys.argv[1]=="--debug":
debugparam="--debug"
sys.argv.remove(debugparam)
else:
printUsage()
elif len(sys.argv)>2:
printUsage()
suite = None
filenames = os.listdir('.')
for filename in filenames:
......@@ -26,6 +43,8 @@ if __name__ == '__main__':
suite = tests
else:
suite.addTests(tests)
unittest.TextTestRunner(verbosity=1).run(suite)
if debugparam:
suite.debug()
else:
unittest.TextTestRunner(verbosity=1).run(suite)
......@@ -756,7 +756,8 @@ class CLinker(link.Linker):
orphd = [[orphan.data] for orphan in self.orphans]
ret = module.instantiate(error_storage, *(in_storage + out_storage + orphd))
assert sys.getrefcount(ret) == 2 # refcount leak check
#win pdb add 3 ref count, so we disable it by default.
#assert sys.getrefcount(ret) == 2 # refcount leak check
return ret
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论