[all-commits] [llvm/llvm-project] f2efef: [llvm-lit] Ignore malformed `.lit_test_times` entries

Jonathan Thackray via All-commits all-commits at lists.llvm.org
Fri Apr 17 08:31:48 PDT 2026


  Branch: refs/heads/users/jthackray/fix_llvm_lit
  Home:   https://github.com/llvm/llvm-project
  Commit: f2efef36d605c3bc4a375c82b0170f8809b32c6f
      https://github.com/llvm/llvm-project/commit/f2efef36d605c3bc4a375c82b0170f8809b32c6f
  Author: Jonathan Thackray <jonathan.thackray at arm.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M llvm/utils/lit/lit/TestTimes.py
    A llvm/utils/lit/tests/Inputs/malformed-test-times/a.txt
    A llvm/utils/lit/tests/Inputs/malformed-test-times/b.txt
    A llvm/utils/lit/tests/Inputs/malformed-test-times/lit.cfg
    A llvm/utils/lit/tests/Inputs/malformed-test-times/lit_test_times
    A llvm/utils/lit/tests/malformed-test-times.py

  Log Message:
  -----------
  [llvm-lit] Ignore malformed `.lit_test_times` entries

When running `llvm-lit`, I sometimes hit a traceback, because a
`.lit_test_times.txt` file has got corrupted (not sure how).
However, it's non-obvious what the issue is (you just get a traceback),
so I've fixed this as follows:

`read_test_times()` currently assumes every line in .lit_test_times.txt
contains a floating-point time followed by a test path. If the file
contains a blank line, a line without a path, or a non-numeric time,
lit raises during discovery instead of skipping the bad entry.

Fix this by parsing each line defensively. Split once, ignore lines
that do not produce both fields, and ignore entries whose time cannot
be parsed as a float. This keeps the existing behavior for valid lines
while making malformed timing files non-fatal.

Add a new `malformed-test-times.py` regression test and a checked-in
lit_test_times fixture containing both valid and malformed entries. The
test copies that fixture into `.lit_test_times.txt`, checks that lit still
discovers and runs both tests, and verifies that the valid timing entries
still order `b.txt` before `a.txt`.


  Commit: c3e3c65de781a1f5b62690eb8d73fc342ca49545
      https://github.com/llvm/llvm-project/commit/c3e3c65de781a1f5b62690eb8d73fc342ca49545
  Author: Jonathan Thackray <jonathan.thackray at arm.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    M llvm/utils/lit/lit/Test.py
    M llvm/utils/lit/lit/TestTimes.py
    M llvm/utils/lit/lit/discovery.py
    M llvm/utils/lit/tests/malformed-test-times.py

  Log Message:
  -----------
  fixup! Address PR comments


Compare: https://github.com/llvm/llvm-project/compare/6b2c2fe54f5b...c3e3c65de781

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list