llvm-project/llvm/utils/lit/tests/time-tests.py
Vincent Lee 867ff2d426
[lit] Add a flag to disable lit time tests (#98270)
LLVM lit assumes control of the test parallelism when running a test
suite. This style of testing doesn't play nicely with build systems like
Buck or Bazel since it prefers finer grained actions on a per-test
level. In order for external build systems to control the test
parallelism, add an option to disable `.lit_test_times.txt` under the
`--skip-test-time-recording` flag, thus allowing other build systems 
to determine the parallelism and avoid race conditions when writing 
to that file. I went for `--skip-test-time-recording` instead of `--time-tests` in 
order to preserve the original functionality of writing to `.lit_test_times.txt`
as the default behavior and only opt-in for those who do _not_ want
`.lit_test_times.txt` file.
2024-07-20 00:13:20 -07:00

16 lines
712 B
Python

## Check that --skip-test-time-recording skips .lit_test_times.txt recording.
# RUN: %{lit-no-order-opt} --skip-test-time-recording %{inputs}/time-tests
# RUN: not ls %{inputs}/time-tests/.lit_test_times.txt
## Check that --time-tests generates a printed histogram.
# RUN: %{lit-no-order-opt} --time-tests %{inputs}/time-tests > %t.out
# RUN: FileCheck < %t.out %s
# RUN: rm %{inputs}/time-tests/.lit_test_times.txt
# CHECK: Tests Times:
# CHECK-NEXT: --------------------------------------------------------------------------
# CHECK-NEXT: [ Range ] :: [ Percentage ] :: [Count]
# CHECK-NEXT: --------------------------------------------------------------------------