Skip to content

Commit 70605ff

Browse files
author
Julian Lettner
committed
[lit] Don't crash for --time-tests in aborted test run
Properly print the test times histogram even for aborted (user interrupt, [Ctrl+C]) test runs.
1 parent af28e02 commit 70605ff

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/utils/lit/lit/main.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def main(builtin_params={}):
9494
t for t in selected_tests if t.result.code != lit.Test.SKIPPED]
9595

9696
if opts.time_tests:
97-
print_histogram(executed_tests)
97+
print_histogram(discovered_tests)
9898

9999
print_results(discovered_tests, elapsed, opts)
100100

@@ -257,8 +257,10 @@ def execute_in_tmp_dir(run, lit_config):
257257

258258

259259
def print_histogram(tests):
260-
test_times = [(t.getFullName(), t.result.elapsed) for t in tests]
261-
lit.util.printHistogram(test_times, title='Tests')
260+
test_times = [(t.getFullName(), t.result.elapsed)
261+
for t in tests if t.result.elapsed]
262+
if test_times:
263+
lit.util.printHistogram(test_times, title='Tests')
262264

263265

264266
def add_result_category(result_code, label):

0 commit comments

Comments
 (0)