Skip to content

Commit 1d48493

Browse files
author
serge-sans-paille
committed
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
1 parent 5adbf7d commit 1d48493

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

llvm/utils/lit/lit/cl_arguments.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ def parse_args():
1515
parser.add_argument("--version",
1616
dest="show_version",
1717
help="Show version and exit",
18-
action="store_true")
18+
version="lit " + lit.__version__,
19+
action="version")
20+
1921
parser.add_argument("-j", "--threads", "--workers",
2022
dest="workers",
2123
metavar="N",

llvm/utils/lit/lit/main.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
def main(builtin_params={}):
2222
opts = lit.cl_arguments.parse_args()
2323

24-
if opts.show_version:
25-
print("lit %s" % lit.__version__)
26-
return
27-
2824
params = create_params(builtin_params, opts.user_params)
2925
is_windows = platform.system() == 'Windows'
3026

llvm/utils/lit/tests/version.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Basic sanity check that --version works.
2+
#
3+
# RUN: %{lit} --version | FileCheck %s
4+
#
5+
# CHECK: lit {{[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9]*}}

0 commit comments

Comments
 (0)