summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2013-08-07 03:11:42 +0000
committerDaniel Dunbar <daniel@zuster.org>2013-08-07 03:11:42 +0000
commit3915c080ccdd872893412c0a8eaa29f2cec05761 (patch)
tree8b36a2ff0fabdb1303035e9eef47ceb3137a404b /utils
parentcd594283f7b5ab7031a0da25c26f4dd81e491433 (diff)
downloadllvm-3915c080ccdd872893412c0a8eaa29f2cec05761.tar.gz
llvm-3915c080ccdd872893412c0a8eaa29f2cec05761.tar.bz2
llvm-3915c080ccdd872893412c0a8eaa29f2cec05761.tar.xz
[lit] Add a --show-tests option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rwxr-xr-xutils/lit/lit/main.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/utils/lit/lit/main.py b/utils/lit/lit/main.py
index c54ec3b5e6..0faa55ed39 100755
--- a/utils/lit/lit/main.py
+++ b/utils/lit/lit/main.py
@@ -242,6 +242,9 @@ def main(builtinParameters = {}):
group.add_option("", "--show-suites", dest="showSuites",
help="Show discovered test suites",
action="store_true", default=False)
+ group.add_option("", "--show-tests", dest="showTests",
+ help="Show all discovered tests",
+ action="store_true", default=False)
group.add_option("", "--repeat", dest="repeatTests", metavar="N",
help="Repeat tests N times (for timing)",
action="store", default=None, type=int)
@@ -288,21 +291,32 @@ def main(builtinParameters = {}):
tests = lit.discovery.find_tests_for_inputs(litConfig, inputs)
- if opts.showSuites:
+ if opts.showSuites or opts.showTests:
+ # Aggregate the tests by suite.
suitesAndTests = {}
for t in tests:
if t.suite not in suitesAndTests:
suitesAndTests[t.suite] = []
suitesAndTests[t.suite].append(t)
-
- print '-- Test Suites --'
suitesAndTests = suitesAndTests.items()
suitesAndTests.sort(key = lambda (ts,_): ts.name)
- for ts,ts_tests in suitesAndTests:
- print ' %s - %d tests' %(ts.name, len(ts_tests))
- print ' Source Root: %s' % ts.source_root
- print ' Exec Root : %s' % ts.exec_root
+ # Show the suites, if requested.
+ if opts.showSuites:
+ print '-- Test Suites --'
+ for ts,ts_tests in suitesAndTests:
+ print ' %s - %d tests' %(ts.name, len(ts_tests))
+ print ' Source Root: %s' % ts.source_root
+ print ' Exec Root : %s' % ts.exec_root
+
+ # Show the tests, if requested.
+ if opts.showTests:
+ print '-- Available Tests --'
+ for ts,ts_tests in suitesAndTests:
+ ts_tests.sort(key = lambda test: test.path_in_suite)
+ for test in ts_tests:
+ print ' %s' % (test.getFullName(),)
+
# Select and order the tests.
numTotalTests = len(tests)