Index: llvm/utils/lit/lit/TestTimes.py =================================================================== --- llvm/utils/lit/lit/TestTimes.py +++ llvm/utils/lit/lit/TestTimes.py @@ -28,7 +28,7 @@ # used as an actual path to a filesystem API, therefore we use '/' as # the canonical separator so that Unix and Windows machines can share # timing data. - times_by_suite[t.suite.exec_root]['/'.join(t.path_in_suite)] = t.result.elapsed + times_by_suite[t.suite.exec_root]['/'.join(t.path_in_suite)] = time for s, value in times_by_suite.items(): try: Index: llvm/utils/lit/tests/Inputs/save-failed/fail.txt =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/save-failed/fail.txt @@ -0,0 +1 @@ +# RUN: false Index: llvm/utils/lit/tests/Inputs/save-failed/lit.cfg =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/save-failed/lit.cfg @@ -0,0 +1,6 @@ +import lit.formats +config.name = 'save-failed' +config.suffixes = ['.txt'] +config.test_format = lit.formats.ShTest() +config.test_source_root = None +config.test_exec_root = None Index: llvm/utils/lit/tests/Inputs/save-failed/pass.txt =================================================================== --- /dev/null +++ llvm/utils/lit/tests/Inputs/save-failed/pass.txt @@ -0,0 +1 @@ +# RUN: true Index: llvm/utils/lit/tests/save-failed.py =================================================================== --- /dev/null +++ llvm/utils/lit/tests/save-failed.py @@ -0,0 +1,7 @@ +# Check that failed tests are saved with negative test time to indicate failure + +# RUN: not %{lit} %{inputs}/save-failed +# RUN: FileCheck %s < %{inputs}/save-failed/.lit_test_times.txt + +# CHECK-DAG: {{^[^-].*}} pass.txt +# CHECK-DAG: {{^-.*}} fail.txt