Skip to content

Commit c4314cf

Browse files
committed
ensure a type of benchmark is selected so html report doesn't blow up
1 parent a5ababe commit c4314cf

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

run_benchmarks

+11-8
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,9 @@ def main():
445445
parser.add_argument('--benchmarks', type=str,
446446
help='comma-separated list of benchmarks to run ' +
447447
'(regular expressions are supported)')
448+
parser.add_argument('type', type=str,
449+
choices={b['name'].split('-', 1)[0] for b in benchmarks},
450+
help='type of benchmark to run')
448451
parser.add_argument('--concurrency-levels', type=int, default=[10],
449452
nargs='+',
450453
help='a list of concurrency levels to use')
@@ -461,11 +464,14 @@ def main():
461464
if not os.path.exists(_socket):
462465
os.mkdir(_socket)
463466

467+
benchmarks_to_run = [b for b in benchmarks
468+
if b['name'].startswith(args.type)]
464469
if args.benchmarks:
465-
benchmarks_to_run = [re.compile(b) for b in args.benchmarks.split(',')]
466-
else:
467-
benchmarks_to_run = [re.compile(re.escape(b['name']))
468-
for b in benchmarks]
470+
patterns = [re.compile(p) for p in args.benchmarks.split(',')]
471+
benchmarks_to_run = [
472+
b
473+
for b in benchmarks_to_run
474+
if any(p.match(b['name']) for p in patterns)]
469475

470476
benchmarks_data = []
471477

@@ -489,10 +495,7 @@ def main():
489495
warmup = ['--msize=1024', '--duration=10',
490496
'--concurrency={}'.format(warmup_concurrency)]
491497

492-
for benchmark in benchmarks:
493-
if not any(b.match(benchmark['name']) for b in benchmarks_to_run):
494-
continue
495-
498+
for benchmark in benchmarks_to_run:
496499
print(benchmark['title'])
497500
print('=' * len(benchmark['title']))
498501
print()

0 commit comments

Comments
 (0)