mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 01:46:15 +01:00
New option in waf_unit_tests --clear-failed - Issue 1678
This commit is contained in:
parent
25ce2ac6da
commit
3430e18205
@ -16,7 +16,6 @@ out = 'build'
|
||||
def options(opt):
|
||||
opt.load('compiler_cxx')
|
||||
opt.load('waf_unit_test')
|
||||
opt.add_option('--onlytests', action='store_true', default=True, help='Exec unit tests only', dest='only_tests')
|
||||
|
||||
def configure(conf):
|
||||
conf.load('compiler_cxx')
|
||||
@ -57,6 +56,7 @@ def build(bld):
|
||||
# $ waf --alltests
|
||||
# to set this behaviour permanenly:
|
||||
bld.options.all_tests = True
|
||||
#bld.options.clear_failed_tests = True
|
||||
|
||||
# debugging zone:
|
||||
# $ waf --zones=ut
|
||||
|
@ -132,13 +132,18 @@ class utest(Task.Task):
|
||||
proc = Utils.subprocess.Popen(self.ut_exec, cwd=cwd, env=self.get_test_env(), stderr=Utils.subprocess.PIPE, stdout=Utils.subprocess.PIPE)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
|
||||
tup = (filename, proc.returncode, stdout, stderr)
|
||||
self.waf_unit_test_results = tup = (filename, proc.returncode, stdout, stderr)
|
||||
testlock.acquire()
|
||||
try:
|
||||
return self.generator.add_test_results(tup)
|
||||
finally:
|
||||
testlock.release()
|
||||
|
||||
def post_run(self):
|
||||
super(utest, self).post_run()
|
||||
if getattr(Options.options, 'clear_failed_tests', False) and self.waf_unit_test_results[1]:
|
||||
self.generator.bld.task_sigs[self.uid()] = None
|
||||
|
||||
def summary(bld):
|
||||
"""
|
||||
Display an execution summary::
|
||||
@ -194,6 +199,7 @@ def options(opt):
|
||||
"""
|
||||
opt.add_option('--notests', action='store_true', default=False, help='Exec no unit tests', dest='no_tests')
|
||||
opt.add_option('--alltests', action='store_true', default=False, help='Exec all unit tests', dest='all_tests')
|
||||
opt.add_option('--clear-failed', action='store_true', default=False, help='Force failed unit tests to run again next time', dest='clear_failed_tests')
|
||||
opt.add_option('--testcmd', action='store', default=False,
|
||||
help = 'Run the unit tests using the test-cmd string'
|
||||
' example "--test-cmd="valgrind --error-exitcode=1'
|
||||
|
Loading…
Reference in New Issue
Block a user