Skip to content

[LIT] Tests take entire timeout duration after failing when exception is thrown in internal shell #133914

Closed
@ayylol

Description

@ayylol

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.

try:
self._wait_for(async_results, deadline)
except:
pool.terminate()
raise
finally:
pool.join()

This is related to this:
https://stackoverflow.com/questions/15314189/python-multiprocessing-pool-hangs-at-join

To Reproduce

  1. Add a test that will try to execute a non-existent file:
; llvm-project/llvm/test/hang.ll
; RUN: non-existent
  1. Change the test suite's configuration to use the internal shell. (Remove the not from this line)
    config.test_format = lit.formats.ShTest(not llvm_config.use_lit_shell)
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions