scripts: Added -q/--quiet to test.py/bench.py
This will probably only have niche uses, but may be useful for small test sets or for running specific tests with -O-. Though it is a bit funny that -q -O- turns test.py/bench.py into more or less just a complicated way to run a C program.
This commit is contained in:
+9
-1
@@ -1223,7 +1223,8 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
|
|||||||
daemon=True))
|
daemon=True))
|
||||||
|
|
||||||
def print_update(done):
|
def print_update(done):
|
||||||
if (not args.get('verbose')
|
if (not args.get('quiet')
|
||||||
|
and not args.get('verbose')
|
||||||
and not args.get('stdout') == '-'
|
and not args.get('stdout') == '-'
|
||||||
and (args['color'] or done)):
|
and (args['color'] or done)):
|
||||||
sys.stdout.write('%s%srunning %s%s:%s %s%s' % (
|
sys.stdout.write('%s%srunning %s%s:%s %s%s' % (
|
||||||
@@ -1284,6 +1285,7 @@ def run_stage(name, runner, bench_ids, stdout_, trace_, output_, **args):
|
|||||||
|
|
||||||
def run(runner, bench_ids=[], **args):
|
def run(runner, bench_ids=[], **args):
|
||||||
# query runner for benches
|
# query runner for benches
|
||||||
|
if not args.get('quiet'):
|
||||||
print('using runner: %s' % ' '.join(
|
print('using runner: %s' % ' '.join(
|
||||||
shlex.quote(c) for c in find_runner(runner, **args)))
|
shlex.quote(c) for c in find_runner(runner, **args)))
|
||||||
|
|
||||||
@@ -1294,6 +1296,7 @@ def run(runner, bench_ids=[], **args):
|
|||||||
expected_case_perms,
|
expected_case_perms,
|
||||||
expected_perms,
|
expected_perms,
|
||||||
total_perms) = find_perms(runner, bench_ids, **args)
|
total_perms) = find_perms(runner, bench_ids, **args)
|
||||||
|
if not args.get('quiet'):
|
||||||
print('found %d suites, %d cases, %d/%d permutations' % (
|
print('found %d suites, %d cases, %d/%d permutations' % (
|
||||||
len(expected_suite_perms),
|
len(expected_suite_perms),
|
||||||
len(expected_case_perms),
|
len(expected_case_perms),
|
||||||
@@ -1377,6 +1380,7 @@ def run(runner, bench_ids=[], **args):
|
|||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
# show summary
|
# show summary
|
||||||
|
if not args.get('quiet'):
|
||||||
print()
|
print()
|
||||||
print('%sdone:%s %s' % (
|
print('%sdone:%s %s' % (
|
||||||
('\x1b[34m' if not failed else '\x1b[31m')
|
('\x1b[34m' if not failed else '\x1b[31m')
|
||||||
@@ -1505,6 +1509,10 @@ if __name__ == "__main__":
|
|||||||
'-v', '--verbose',
|
'-v', '--verbose',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Output commands that run behind the scenes.")
|
help="Output commands that run behind the scenes.")
|
||||||
|
parser.add_argument(
|
||||||
|
'-q', '--quiet',
|
||||||
|
action='store_true',
|
||||||
|
help="Show nothing except for bench failures.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--color',
|
'--color',
|
||||||
choices=['never', 'always', 'auto'],
|
choices=['never', 'always', 'auto'],
|
||||||
|
|||||||
+9
-1
@@ -1207,7 +1207,8 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args):
|
|||||||
daemon=True))
|
daemon=True))
|
||||||
|
|
||||||
def print_update(done):
|
def print_update(done):
|
||||||
if (not args.get('verbose')
|
if (not args.get('quiet')
|
||||||
|
and not args.get('verbose')
|
||||||
and not args.get('stdout') == '-'
|
and not args.get('stdout') == '-'
|
||||||
and (args['color'] or done)):
|
and (args['color'] or done)):
|
||||||
sys.stdout.write('%s%srunning %s%s:%s %s%s' % (
|
sys.stdout.write('%s%srunning %s%s:%s %s%s' % (
|
||||||
@@ -1268,6 +1269,7 @@ def run_stage(name, runner, test_ids, stdout_, trace_, output_, **args):
|
|||||||
|
|
||||||
def run(runner, test_ids=[], **args):
|
def run(runner, test_ids=[], **args):
|
||||||
# query runner for tests
|
# query runner for tests
|
||||||
|
if not args.get('quiet'):
|
||||||
print('using runner: %s' % ' '.join(
|
print('using runner: %s' % ' '.join(
|
||||||
shlex.quote(c) for c in find_runner(runner, **args)))
|
shlex.quote(c) for c in find_runner(runner, **args)))
|
||||||
|
|
||||||
@@ -1278,6 +1280,7 @@ def run(runner, test_ids=[], **args):
|
|||||||
expected_case_perms,
|
expected_case_perms,
|
||||||
expected_perms,
|
expected_perms,
|
||||||
total_perms) = find_perms(runner, test_ids, **args)
|
total_perms) = find_perms(runner, test_ids, **args)
|
||||||
|
if not args.get('quiet'):
|
||||||
print('found %d suites, %d cases, %d/%d permutations' % (
|
print('found %d suites, %d cases, %d/%d permutations' % (
|
||||||
len(expected_suite_perms),
|
len(expected_suite_perms),
|
||||||
len(expected_case_perms),
|
len(expected_case_perms),
|
||||||
@@ -1355,6 +1358,7 @@ def run(runner, test_ids=[], **args):
|
|||||||
output.close()
|
output.close()
|
||||||
|
|
||||||
# show summary
|
# show summary
|
||||||
|
if not args.get('quiet'):
|
||||||
print()
|
print()
|
||||||
print('%sdone:%s %s' % (
|
print('%sdone:%s %s' % (
|
||||||
('\x1b[32m' if not failed else '\x1b[31m')
|
('\x1b[32m' if not failed else '\x1b[31m')
|
||||||
@@ -1521,6 +1525,10 @@ if __name__ == "__main__":
|
|||||||
'-v', '--verbose',
|
'-v', '--verbose',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help="Output commands that run behind the scenes.")
|
help="Output commands that run behind the scenes.")
|
||||||
|
parser.add_argument(
|
||||||
|
'-q', '--quiet',
|
||||||
|
action='store_true',
|
||||||
|
help="Show nothing except for test failures.")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--color',
|
'--color',
|
||||||
choices=['never', 'always', 'auto'],
|
choices=['never', 'always', 'auto'],
|
||||||
|
|||||||
Reference in New Issue
Block a user