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

Daniel Dunbar daniel at zuster.org
Thu Nov 5 08:27:33 PST 2009


Author: ddunbar
Date: Thu Nov  5 10:27:33 2009
New Revision: 86137

URL: http://llvm.org/viewvc/llvm-project?rev=86137&view=rev
Log:
lit: Add --param NAME=VALUE option, for test suite specific use (to communicate
arbitrary command line arguments to the test suite).

Modified:
    llvm/trunk/docs/CommandGuide/lit.pod
    llvm/trunk/utils/lit/LitConfig.py
    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=86137&r1=86136&r2=86137&view=diff

==============================================================================
--- llvm/trunk/docs/CommandGuide/lit.pod (original)
+++ llvm/trunk/docs/CommandGuide/lit.pod Thu Nov  5 10:27:33 2009
@@ -54,6 +54,12 @@
 Search for I<NAME.cfg> and I<NAME.site.cfg> when searching for test suites,
 instead I<lit.cfg> and I<lit.site.cfg>.
 
+=item B<--param> I<NAME>, B<--param> I<NAME>=I<VALUE>
+
+Add a user defined parameter I<NAME> with the given I<VALUE> (or the empty
+string if not given). The meaning and use of these parameters is test suite
+dependent.
+
 =back 
 
 =head1 OUTPUT OPTIONS

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

==============================================================================
--- llvm/trunk/utils/lit/LitConfig.py (original)
+++ llvm/trunk/utils/lit/LitConfig.py Thu Nov  5 10:27:33 2009
@@ -17,7 +17,8 @@
     def __init__(self, progname, path, quiet,
                  useValgrind, valgrindArgs,
                  useTclAsSh,
-                 noExecute, debug, isWindows):
+                 noExecute, debug, isWindows,
+                 params):
         # The name of the test runner.
         self.progname = progname
         # The items to add to the PATH environment variable.
@@ -29,6 +30,7 @@
         self.noExecute = noExecute
         self.debug = debug
         self.isWindows = bool(isWindows)
+        self.params = dict(params)
         self.bashPath = None
 
         self.numErrors = 0

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

==============================================================================
--- llvm/trunk/utils/lit/lit.py (original)
+++ llvm/trunk/utils/lit/lit.py Thu Nov  5 10:27:33 2009
@@ -321,6 +321,10 @@
     parser.add_option("", "--config-prefix", dest="configPrefix",
                       metavar="NAME", help="Prefix for 'lit' config files",
                       action="store", default=None)
+    parser.add_option("", "--param", dest="userParameters",
+                      metavar="NAME=VAL",
+                      help="Add 'NAME' = 'VAL' to the user defined parameters",
+                      type=str, action="append", default=[])
 
     group = OptionGroup(parser, "Output Format")
     # FIXME: I find these names very confusing, although I like the
@@ -396,6 +400,15 @@
 
     inputs = args
 
+    # Create the user defined parameters.
+    userParams = {}
+    for entry in opts.userParameters:
+        if '=' not in entry:
+            name,val = entry,''
+        else:
+            name,val = entry.split('=', 1)
+        userParams[name] = val
+
     # Create the global config object.
     litConfig = LitConfig.LitConfig(progname = os.path.basename(sys.argv[0]),
                                     path = opts.path,
@@ -405,7 +418,8 @@
                                     useTclAsSh = opts.useTclAsSh,
                                     noExecute = opts.noExecute,
                                     debug = opts.debug,
-                                    isWindows = (platform.system()=='Windows'))
+                                    isWindows = (platform.system()=='Windows'),
+                                    params = userParams)
 
     # Load the tests from the inputs.
     tests = []





More information about the llvm-commits mailing list