Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions benchmark/scripts/Benchmark_Driver
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,10 @@ def instrument_test(driver_path, test, num_samples):
def get_tests(driver_path, args):
"""Return a list of available performance tests"""
tests = subprocess.check_output([driver_path, '--list']).split()[2:]
if args.filter:
return filter(lambda name: name.startswith(args.filter), tests)
if args.filters:
regexes = [re.compile(pattern) for pattern in args.filters]
return sorted(list(set([name for pattern in regexes
for name in tests if pattern.match(name)])))
if not args.benchmarks:
return tests
return sorted(list(set(tests).intersection(set(args.benchmarks))))
Expand Down Expand Up @@ -350,7 +352,7 @@ def positive_int(value):

def main():
parser = argparse.ArgumentParser(
epilog='Example: ./Benchmark_Driver run -i 5 -f Array'
epilog='Example: ./Benchmark_Driver run -i 5 -f Prefix -f .*Suffix.*'
)
subparsers = parser.add_subparsers(
title='Swift benchmark driver commands',
Expand All @@ -363,8 +365,9 @@ def main():
default=[],
help='benchmark to run (default: all)', nargs='*', metavar="BENCHMARK")
benchmarks_group.add_argument(
'-f', '--filter',
help='run all tests whose name starts with PREFIX', metavar="PREFIX")
'-f', '--filter', dest='filters', action='append',
help='run all tests whose name match regular expression PATTERN, ' +
'multiple filters are supported', metavar="PATTERN")
parent_parser.add_argument(
'-t', '--tests',
help='directory containing Benchmark_O{,none,unchecked} ' +
Expand Down