diff options
-rwxr-xr-x | programs/run.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/programs/run.py b/programs/run.py index e436847..787d37c 100755 --- a/programs/run.py +++ b/programs/run.py @@ -29,10 +29,12 @@ from argparse import ArgumentParser from multiprocessing import cpu_count import os import os.path as path +import re import sys from framework.database import ResultDatabase from framework.runner import resume +from framework.filters import filterTests import suites def parseArguments(argv, config): @@ -40,10 +42,11 @@ def parseArguments(argv, config): p.add_argument('-d', '--dry-run', action='store_true', help='Do not actually run tests, but show what would be performed', default=False) - p.add_argument('-t', '--tests', action='append', dest='include_filters', + p.add_argument('-t', '--tests', action='append', dest='includeFilters', metavar='<regexp>', help='Run only matching tests (regular expression)') - p.add_argument('-x', '--exclude', action='append', dest='exclude_filters', + p.add_argument('-x', '--exclude', action='append', dest='excludeFilters', + default=[], metavar='<regexp>', help='Exclude matching tests (regular expression)') p.add_argument('-c', '--threads', action='store', type=int, @@ -72,7 +75,14 @@ def parseArguments(argv, config): def main(argv, config): args = parseArguments(argv, config) - tests = suites.loadTestLists(config, args.suites) + # Compile filter regular expressions + includeFilters = None + if args.includeFilters: + includeFilters = [re.compile(x) for x in args.includeFilters] + excludeFilters = [re.compile(x) for x in args.excludeFilters] + + allTests = suites.loadTestLists(config, args.suites) + tests = filterTests(allTests, includeFilters, excludeFilters) #for test in sorted(tests.keys()): # print(test) |