[PATCH] Lit: Allow overriding llvm tool paths+arguments, make -D an alias for --param

Daniel Dunbar daniel at zuster.org
Mon May 4 13:14:47 PDT 2015


Fine by me, can you also update the 'lit' docs in CommandGuide to note this.

On Monday, May 4, 2015, Matthias Braun <matze at braunis.de> wrote:

> Hi ddunbar,
>
> These changes allow usages where you want to pass an additional
> commandline option to all invocations of a specific llvm tool. Example:
>
> > llvm-lit -Dllc=llc -enable-misched -verify-machineinstrs
>
> REPOSITORY
>   rL LLVM
>
> http://reviews.llvm.org/D9487
>
> Files:
>   test/lit.cfg
>   utils/lit/lit/main.py
>
> Index: test/lit.cfg
> ===================================================================
> --- test/lit.cfg
> +++ test/lit.cfg
> @@ -267,8 +267,12 @@
>                            pattern)
>      tool_pipe = tool_match.group(2)
>      tool_name = tool_match.group(4)
> -    tool_path = lit.util.which(tool_name, llvm_tools_dir)
> -    if not tool_path:
> +    # Did the user specify the tool path + arguments? This allows things
> like
> +    # llvm-lit "-Dllc=llc -enable-misched -verify-machineinstrs"
> +    tool_path = lit_config.params.get(tool_name)
> +    if tool_path is None:
> +        tool_path = lit.util.which(tool_name, llvm_tools_dir)
> +    if tool_path is None:
>          # Warn, but still provide a substitution.
>          lit_config.note('Did not find ' + tool_name + ' in ' +
> llvm_tools_dir)
>          tool_path = llvm_tools_dir + '/' + tool_name
> Index: utils/lit/lit/main.py
> ===================================================================
> --- utils/lit/lit/main.py
> +++ utils/lit/lit/main.py
> @@ -146,7 +146,7 @@
>      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",
> +    parser.add_option("-D", "--param", dest="userParameters",
>                        metavar="NAME=VAL",
>                        help="Add 'NAME' = 'VAL' to the user defined
> parameters",
>                        type=str, action="append", default=[])
>
> EMAIL PREFERENCES
>   http://reviews.llvm.org/settings/panel/emailpreferences/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150504/7217a562/attachment.html>


More information about the llvm-commits mailing list