[PATCH] D33271: lit: allow glob patterns as path arguments

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 17 03:37:13 PDT 2017


arichardson created this revision.
Herald added a reviewer: modocache.

This means `./bin/llvm-lit tools/clang/test/CodeGen/*attr*` will now
run all the tests inside clang/test/CodeGen that contain attr in the name
instead of lit returning with an error


Repository:
  rL LLVM

https://reviews.llvm.org/D33271

Files:
  utils/lit/lit/discovery.py


Index: utils/lit/lit/discovery.py
===================================================================
--- utils/lit/lit/discovery.py
+++ utils/lit/lit/discovery.py
@@ -3,6 +3,7 @@
 """
 
 import copy
+import glob
 import os
 import sys
 
@@ -126,6 +127,14 @@
     # caller).
     source_path = ts.getSourcePath(path_in_suite)
     if not os.path.exists(source_path):
+        # check if the path is a glob
+        if any(c in source_path for c in ('*', '[', ']', '?')):
+            if litConfig.debug:
+                litConfig.note('Interpreting source path %r as a glob pattern' % source_path)
+            for path in glob.iglob(source_path):
+                ts, path_in_suite = getTestSuite(path, litConfig, testSuiteCache)
+                lc = getLocalConfig(ts, path_in_suite[:-1], litConfig, localConfigCache)
+                yield Test.Test(ts, path_in_suite, lc)
         return
 
     # Check if the user named a test directly.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33271.99265.patch
Type: text/x-patch
Size: 944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170517/1c5ee00b/attachment.bin>


More information about the llvm-commits mailing list