Added -f/--fail to test.py/bench.py

This just tells test.py/bench.py to pretend the test failed and trigger
any conditional utilities. This can be combined with --gdb to easily
inspect a test that isn't actually failing.

Up until this point I've just been inserting assert(false) when needed,
which is clunky.
This commit is contained in:
Christopher Haster
2024-03-20 13:50:04 -05:00
parent 62de865103
commit 76593711ab
2 changed files with 20 additions and 4 deletions
+10 -2
View File
@@ -1003,6 +1003,10 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args):
last_id = m.group('id')
powerlosses += 1
elif op == 'finished':
# force a failure?
if args.get('fail'):
raise TestFailure(last_id, 0, list(last_stdout))
# passed
case = m.group('case')
suite = case_suites[case]
passed_suite_perms[suite] += 1
@@ -1028,7 +1032,7 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args):
if args.get('keep_going'):
proc.kill()
except KeyboardInterrupt:
raise TestFailure(last_id, 1, list(last_stdout))
raise TestFailure(last_id, 0, list(last_stdout))
finally:
children.remove(proc)
mpty.close()
@@ -1530,7 +1534,11 @@ if __name__ == "__main__":
test_parser.add_argument(
'-k', '--keep-going',
action='store_true',
help="Don't stop on first error.")
help="Don't stop on first failure.")
test_parser.add_argument(
'-f', '--fail',
action='store_true',
help="Force a failure.")
test_parser.add_argument(
'-i', '--isolate',
action='store_true',