Description
When using the internal lit shell, if a test throws an exception and a timeout is set the test will take the entire duration of the timeout before finishing. This can happen for example if we try to execute a non-existent file. The tests hang here, at the pool.join()
call.
llvm-project/llvm/utils/lit/lit/run.py
Lines 87 to 93 in 1997053
This is related to this:
https://stackoverflow.com/questions/15314189/python-multiprocessing-pool-hangs-at-join
To Reproduce
- Add a test that will try to execute a non-existent file:
; llvm-project/llvm/test/hang.ll
; RUN: non-existent
- Change the test suite's configuration to use the internal shell. (Remove the
not
from this line)
llvm-project/llvm/test/lit.cfg.py
Line 21 in c1efd8b
- Run the test with a time out set:
llvm-lit llvm/test/hang.ll -a --timeout=10
The test should fail immediately, but the execution of lit will not conclude until the full timeout elapses.
If instead we use the external shell, or not set a timeout then the execution of lit will conclude immediately after the test fails.