From f626167e69d08f500805d209ff80720240adde3f Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 5 Nov 2009 16:27:33 +0000 Subject: [PATCH] lit: Add --param NAME=VALUE option, for test suite specific use (to communicate arbitrary command line arguments to the test suite). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86137 91177308-0d34-0410-b5e6-96231b3b80d8 --- docs/CommandGuide/lit.pod | 6 ++++++ utils/lit/LitConfig.py | 4 +++- utils/lit/lit.py | 16 +++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/CommandGuide/lit.pod b/docs/CommandGuide/lit.pod index 929aed798b0..97c3e578e6b 100644 --- a/docs/CommandGuide/lit.pod +++ b/docs/CommandGuide/lit.pod @@ -54,6 +54,12 @@ number of detected available CPUs. Search for I and I when searching for test suites, instead I and I. +=item B<--param> I, B<--param> I=I + +Add a user defined parameter I with the given I (or the empty +string if not given). The meaning and use of these parameters is test suite +dependent. + =back =head1 OUTPUT OPTIONS diff --git a/utils/lit/LitConfig.py b/utils/lit/LitConfig.py index c334109e1de..0e0a4931dca 100644 --- a/utils/lit/LitConfig.py +++ b/utils/lit/LitConfig.py @@ -17,7 +17,8 @@ class LitConfig: 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 @@ class LitConfig: self.noExecute = noExecute self.debug = debug self.isWindows = bool(isWindows) + self.params = dict(params) self.bashPath = None self.numErrors = 0 diff --git a/utils/lit/lit.py b/utils/lit/lit.py index a856473c228..462f912e0b8 100755 --- a/utils/lit/lit.py +++ b/utils/lit/lit.py @@ -321,6 +321,10 @@ def main(): 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 @@ def main(): 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 @@ def main(): 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 = [] -- 2.34.1