diff --git a/demos/unit_test/wscript b/demos/unit_test/wscript index 037a7624..bfbad807 100644 --- a/demos/unit_test/wscript +++ b/demos/unit_test/wscript @@ -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 diff --git a/waflib/Tools/waf_unit_test.py b/waflib/Tools/waf_unit_test.py index 27cd9a40..f5cbcfc5 100644 --- a/waflib/Tools/waf_unit_test.py +++ b/waflib/Tools/waf_unit_test.py @@ -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'