[llvm-commits] [llvm] r85035 - in /llvm/trunk: docs/CommandGuide/lit.pod utils/lit/lit.py

Daniel Dunbar daniel at zuster.org
Sat Oct 24 20:31:01 PDT 2009


Author: ddunbar
Date: Sat Oct 24 22:30:55 2009
New Revision: 85035

URL: http://llvm.org/viewvc/llvm-project?rev=85035&view=rev
Log:
lit: Add --config-prefix option, to override default config file names.

Modified:
    llvm/trunk/docs/CommandGuide/lit.pod
    llvm/trunk/utils/lit/lit.py

Modified: llvm/trunk/docs/CommandGuide/lit.pod
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CommandGuide/lit.pod?rev=85035&r1=85034&r2=85035&view=diff

==============================================================================
--- llvm/trunk/docs/CommandGuide/lit.pod (original)
+++ llvm/trunk/docs/CommandGuide/lit.pod Sat Oct 24 22:30:55 2009
@@ -49,6 +49,11 @@
 Run I<N> tests in parallel. By default, this is automatically chose to match the
 number of detected available CPUs.
 
+=item B<--config-prefix>=I<NAME>
+
+Search for I<NAME.cfg> and I<NAME.site.cfg> when searching for test suites,
+instead I<lit.cfg> and I<lit.site.cfg>.
+
 =back 
 
 =head1 OUTPUT OPTIONS

Modified: llvm/trunk/utils/lit/lit.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit.py?rev=85035&r1=85034&r2=85035&view=diff

==============================================================================
--- llvm/trunk/utils/lit/lit.py (original)
+++ llvm/trunk/utils/lit/lit.py Sat Oct 24 22:30:55 2009
@@ -16,9 +16,13 @@
 import LitConfig
 import Test
 
+# Configuration files to look for when discovering test suites. These can be
+# overridden with --config-prefix.
+#
 # FIXME: Rename to 'config.lit', 'site.lit', and 'local.lit' ?
-kConfigName = 'lit.cfg'
-kSiteConfigName = 'lit.site.cfg'
+gConfigName = 'lit.cfg'
+gSiteConfigName = 'lit.site.cfg'
+
 kLocalConfigName = 'lit.local.cfg'
 
 class TestingProgressDisplay:
@@ -134,10 +138,10 @@
         self.display.update(test)
 
 def dirContainsTestSuite(path):
-    cfgpath = os.path.join(path, kSiteConfigName)
+    cfgpath = os.path.join(path, gSiteConfigName)
     if os.path.exists(cfgpath):
         return cfgpath
-    cfgpath = os.path.join(path, kConfigName)
+    cfgpath = os.path.join(path, gConfigName)
     if os.path.exists(cfgpath):
         return cfgpath
 
@@ -268,7 +272,7 @@
         file_sourcepath = os.path.join(source_path, filename)
         if not os.path.isdir(file_sourcepath):
             continue
-        
+
         # Check for nested test suites, first in the execpath in case there is a
         # site configuration and then in the source path.
         file_execpath = ts.getExecPath(path_in_suite + (filename,))
@@ -283,7 +287,7 @@
             subiter = getTestsInSuite(ts, path_in_suite + (filename,),
                                       litConfig, testSuiteCache,
                                       localConfigCache)
-        
+
         for res in subiter:
             yield res
 
@@ -314,6 +318,9 @@
     parser.add_option("-j", "--threads", dest="numThreads", metavar="N",
                       help="Number of testing threads",
                       type=int, action="store", default=None)
+    parser.add_option("", "--config-prefix", dest="configPrefix",
+                      metavar="NAME", help="Prefix for 'lit' config files",
+                      action="store", default=None)
 
     group = OptionGroup(parser, "Output Format")
     # FIXME: I find these names very confusing, although I like the
@@ -379,6 +386,11 @@
     if not args:
         parser.error('No inputs specified')
 
+    if opts.configPrefix is not None:
+        global gConfigName, gSiteConfigName
+        gConfigName = '%s.cfg' % opts.configPrefix
+        gSiteConfigName = '%s.site.cfg' % opts.configPrefix
+
     if opts.numThreads is None:
         opts.numThreads = Util.detectCPUs()
 
@@ -413,7 +425,8 @@
 
     if opts.showSuites:
         suitesAndTests = dict([(ts,[])
-                               for ts,_ in testSuiteCache.values()])
+                               for ts,_ in testSuiteCache.values()
+                               if ts])
         for t in tests:
             suitesAndTests[t.suite].append(t)
 





More information about the llvm-commits mailing list