From 4f6d5a372075cb0462ce0bd6a56a8e1e9dcae8d5 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 25 Nov 2012 14:22:27 -0800 Subject: Basic -t and -x filtering. --- programs/run.py | 16 +++++++++++++--- 1 file 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='', 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='', 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) -- cgit v1.2.3