Skip to content

Commit 2f8f118

Browse files
committed
Filters are now regullar expression patterns
1 parent 6d9de4c commit 2f8f118

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ def get_tests(driver_path, args):
122122
"""Return a list of available performance tests"""
123123
tests = subprocess.check_output([driver_path, '--list']).split()[2:]
124124
if args.filters:
125-
return sorted(list(set([ name
126-
for prefix in args.filters
127-
for name in tests if name.startswith(prefix) ])))
125+
regexes = [re.compile(pattern) for pattern in args.filters]
126+
return sorted(list(set([name for pattern in regexes
127+
for name in tests if pattern.match(name)])))
128128
if not args.benchmarks:
129129
return tests
130130
return sorted(list(set(tests).intersection(set(args.benchmarks))))
@@ -352,7 +352,7 @@ def positive_int(value):
352352

353353
def main():
354354
parser = argparse.ArgumentParser(
355-
epilog='Example: ./Benchmark_Driver run -i 5 -f Prefix -f Suffix -f Drop'
355+
epilog='Example: ./Benchmark_Driver run -i 5 -f Prefix -f .*Suffix.*'
356356
)
357357
subparsers = parser.add_subparsers(
358358
title='Swift benchmark driver commands',
@@ -366,8 +366,8 @@ def main():
366366
help='benchmark to run (default: all)', nargs='*', metavar="BENCHMARK")
367367
benchmarks_group.add_argument(
368368
'-f', '--filter', dest='filters', action='append',
369-
help='run all tests whose name starts with PREFIX, '+
370-
'multiple filters are supported', metavar="PREFIX")
369+
help='run all tests whose name match regular expression PATTERN, ' +
370+
'multiple filters are supported', metavar="PATTERN")
371371
parent_parser.add_argument(
372372
'-t', '--tests',
373373
help='directory containing Benchmark_O{,none,unchecked} ' +

0 commit comments

Comments
 (0)