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:
+10
-2
@@ -1008,6 +1008,10 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
|
|||||||
last_stdout.clear()
|
last_stdout.clear()
|
||||||
last_assert = None
|
last_assert = None
|
||||||
elif op == 'finished':
|
elif op == 'finished':
|
||||||
|
# force a failure
|
||||||
|
if args.get('fail'):
|
||||||
|
raise BenchFailure(last_id, 0, list(last_stdout))
|
||||||
|
# passed
|
||||||
case = m.group('case')
|
case = m.group('case')
|
||||||
suite = case_suites[case]
|
suite = case_suites[case]
|
||||||
passed_suite_perms[suite] += 1
|
passed_suite_perms[suite] += 1
|
||||||
@@ -1061,7 +1065,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
|
|||||||
proged += proged_
|
proged += proged_
|
||||||
erased += erased_
|
erased += erased_
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise BenchFailure(last_id, 1, list(last_stdout))
|
raise BenchFailure(last_id, 0, list(last_stdout))
|
||||||
finally:
|
finally:
|
||||||
children.remove(proc)
|
children.remove(proc)
|
||||||
mpty.close()
|
mpty.close()
|
||||||
@@ -1513,7 +1517,11 @@ if __name__ == "__main__":
|
|||||||
bench_parser.add_argument(
|
bench_parser.add_argument(
|
||||||
'-k', '--keep-going',
|
'-k', '--keep-going',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Don't stop on first error.")
|
help="Don't stop on first failure.")
|
||||||
|
bench_parser.add_argument(
|
||||||
|
'-f', '--fail',
|
||||||
|
action='store_true',
|
||||||
|
help="Force a failure.")
|
||||||
bench_parser.add_argument(
|
bench_parser.add_argument(
|
||||||
'-i', '--isolate',
|
'-i', '--isolate',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
+10
-2
@@ -1003,6 +1003,10 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args):
|
|||||||
last_id = m.group('id')
|
last_id = m.group('id')
|
||||||
powerlosses += 1
|
powerlosses += 1
|
||||||
elif op == 'finished':
|
elif op == 'finished':
|
||||||
|
# force a failure?
|
||||||
|
if args.get('fail'):
|
||||||
|
raise TestFailure(last_id, 0, list(last_stdout))
|
||||||
|
# passed
|
||||||
case = m.group('case')
|
case = m.group('case')
|
||||||
suite = case_suites[case]
|
suite = case_suites[case]
|
||||||
passed_suite_perms[suite] += 1
|
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'):
|
if args.get('keep_going'):
|
||||||
proc.kill()
|
proc.kill()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise TestFailure(last_id, 1, list(last_stdout))
|
raise TestFailure(last_id, 0, list(last_stdout))
|
||||||
finally:
|
finally:
|
||||||
children.remove(proc)
|
children.remove(proc)
|
||||||
mpty.close()
|
mpty.close()
|
||||||
@@ -1530,7 +1534,11 @@ if __name__ == "__main__":
|
|||||||
test_parser.add_argument(
|
test_parser.add_argument(
|
||||||
'-k', '--keep-going',
|
'-k', '--keep-going',
|
||||||
action='store_true',
|
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(
|
test_parser.add_argument(
|
||||||
'-i', '--isolate',
|
'-i', '--isolate',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
|
|||||||
Reference in New Issue
Block a user