[llvm] 1d48493 - Fix handling of --version in lit
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 12:36:40 PST 2020
Author: serge-sans-paille
Date: 2020-02-13T21:36:12+01:00
New Revision: 1d4849379f71a0f5d73202a291c0b709f7cafbc5
URL: https://github.com/llvm/llvm-project/commit/1d4849379f71a0f5d73202a291c0b709f7cafbc5
DIFF: https://github.com/llvm/llvm-project/commit/1d4849379f71a0f5d73202a291c0b709f7cafbc5.diff
LOG: Fix handling of --version in lit
There's no reason why we should require a directory when asking for the version.
Differential Revision: https://reviews.llvm.org/D74553
Added:
llvm/utils/lit/tests/version.py
Modified:
llvm/utils/lit/lit/cl_arguments.py
llvm/utils/lit/lit/main.py
Removed:
################################################################################
diff --git a/llvm/utils/lit/lit/cl_arguments.py b/llvm/utils/lit/lit/cl_arguments.py
index bac2be29fb9f..402fadb12d6c 100644
--- a/llvm/utils/lit/lit/cl_arguments.py
+++ b/llvm/utils/lit/lit/cl_arguments.py
@@ -15,7 +15,9 @@ def parse_args():
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",
diff --git a/llvm/utils/lit/lit/main.py b/llvm/utils/lit/lit/main.py
index c58b06c7576d..0f0c76bb6bff 100755
--- a/llvm/utils/lit/lit/main.py
+++ b/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'
diff --git a/llvm/utils/lit/tests/version.py b/llvm/utils/lit/tests/version.py
new file mode 100644
index 000000000000..6d1d0fc5c794
--- /dev/null
+++ b/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]*}}
More information about the llvm-commits
mailing list