diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-01-18 00:03:12 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-01-18 00:03:12 +0000 |
commit | 7434c9a053789c04d73bb58df41ad6fdf6a84e6a (patch) | |
tree | 1e4a183189965254727d9d079f115394aadaacac | |
parent | 0271dadee48ccfcb98ed7a7c7849ad3dd0882a44 (diff) | |
download | external_llvm-7434c9a053789c04d73bb58df41ad6fdf6a84e6a.zip external_llvm-7434c9a053789c04d73bb58df41ad6fdf6a84e6a.tar.gz external_llvm-7434c9a053789c04d73bb58df41ad6fdf6a84e6a.tar.bz2 |
[lit] Add a --filter option which is useful when dealing with virtual test
paths.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148362 91177308-0d34-0410-b5e6-96231b3b80d8
-rwxr-xr-x | utils/lit/lit/main.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py index e1a380c..ea2736c 100755 --- a/utils/lit/lit/main.py +++ b/utils/lit/lit/main.py @@ -429,6 +429,10 @@ def main(builtinParameters = {}): # Bump the GIL check interval, its more imp group.add_option("", "--shuffle", dest="shuffle", help="Run tests in random order", action="store_true", default=False) + group.add_option("", "--filter", dest="filter", metavar="EXPRESSION", + help=("Only run tests with paths matching the given " + "regular expression"), + action="store", default=None) parser.add_option_group(group) group = OptionGroup(parser, "Debug and Experimental Options") @@ -540,10 +544,24 @@ def main(builtinParameters = {}): # Bump the GIL check interval, its more imp # Select and order the tests. numTotalTests = len(tests) + + # First, select based on the filter expression if given. + if opts.filter: + try: + rex = re.compile(opts.filter) + except: + parser.error("invalid regular expression for --filter: %r" % ( + opts.filter)) + tests = [t for t in tests + if rex.search(t.getFullName())] + + # Then select the order. if opts.shuffle: random.shuffle(tests) else: tests.sort(key = lambda t: t.getFullName()) + + # Finally limit the number of tests, if desired. if opts.maxTests is not None: tests = tests[:opts.maxTests] |