[PATCH] D74553: Fix handling of --version in lit
serge via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 06:35:30 PST 2020
serge-sans-paille created this revision.
serge-sans-paille added reviewers: paquette, yln, tstellar.
Herald added subscribers: llvm-commits, delcypher.
Herald added a project: LLVM.
There's no reason why we should require a directory when asking for the version.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D74553
Files:
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/main.py
llvm/utils/lit/tests/version.py
Index: llvm/utils/lit/tests/version.py
===================================================================
--- /dev/null
+++ llvm/utils/lit/tests/version.py
@@ -0,0 +1,5 @@
+# Basic sanity check that --version works.
+#
+# RUN: %{lit} --version | FileCheck %s
+#
+# CHECK: lit {{[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9]*}}
Index: llvm/utils/lit/lit/main.py
===================================================================
--- llvm/utils/lit/lit/main.py
+++ llvm/utils/lit/lit/main.py
@@ -21,10 +21,6 @@
def main(builtin_params={}):
opts = lit.cl_arguments.parse_args()
- if opts.show_version:
- print("lit %s" % lit.__version__)
- return
-
params = create_params(builtin_params, opts.user_params)
is_windows = platform.system() == 'Windows'
Index: llvm/utils/lit/lit/cl_arguments.py
===================================================================
--- llvm/utils/lit/lit/cl_arguments.py
+++ llvm/utils/lit/lit/cl_arguments.py
@@ -15,7 +15,9 @@
parser.add_argument("--version",
dest="show_version",
help="Show version and exit",
- action="store_true")
+ version="lit " + lit.__version__,
+ action="version")
+
parser.add_argument("-j", "--threads", "--workers",
dest="workers",
metavar="N",
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74553.244417.patch
Type: text/x-patch
Size: 1321 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200213/b95fcac0/attachment.bin>
More information about the llvm-commits
mailing list