[PATCH] Add per-test timeouts to lit

Daniel Dunbar daniel at zuster.org
Fri Jun 26 14:16:15 PDT 2015


On Fri, Jun 26, 2015 at 1:57 PM, Daniel Dunbar <daniel at zuster.org> wrote:

> Hi Jonathan,
>
> When I try your patch on OS X, the test suite just hangs. Unfortunately I
> don't have much time to investigate...
>

I investigate a little bit, and I believe what happens is that
executeCommand() is hanging in p.communicate(), because the file
descriptors haven't necessarily been closed. It did look like I could fix
this by explicitly forcing a close on the file descriptors in
_safely_kill(), e.g.:
                os.close(popen.stdout.fileno())
                os.close(popen.stderr.fileno())
but I'm not confident that is reliable.

Getting the kind of behavior right is tricky,  esp.  while trying to be
cross platform, and getting it right in Python where it isn't obvious what
layers like subprocess() are doing makes me nervous. Also, I know there are
some gotchas here on Windows that I would want to know are covered. Do you
have access to all three major platforms to test this logic on?

Also, note that kill() will deadlock if it is ever called since both it and
_handler() try to take the lock. In this example, it means that if I Ctrl-C
lit after it hangs in the above then it will deadlock in the context
manager __exit__ function.

 - Daniel


>
>  - Daniel
>
>
> On Thu, Jun 4, 2015 at 11:33 AM, Jonathan Roelofs <
> jonathan at codesourcery.com> wrote:
>
>> Addressed the bug @ericwf pointed out.
>>
>>
>> http://reviews.llvm.org/D6584
>>
>> Files:
>>   utils/lit/lit/LitConfig.py
>>   utils/lit/lit/TestRunner.py
>>   utils/lit/lit/formats/base.py
>>   utils/lit/lit/main.py
>>   utils/lit/lit/util.py
>>   utils/lit/tests/Inputs/timeout/infloop.py
>>   utils/lit/tests/Inputs/timeout/lit.cfg
>>   utils/lit/tests/Inputs/timeout/short.py
>>   utils/lit/tests/timeout.py
>>
>> EMAIL PREFERENCES
>>   http://reviews.llvm.org/settings/panel/emailpreferences/
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150626/8610858a/attachment.html>


More information about the llvm-commits mailing list