[PATCH] D6584: Add per-test timeouts to lit
Daniel Dunbar
daniel at zuster.org
Mon Jul 6 09:04:36 PDT 2015
I was just running the top-level suite, with `lit -sv tests`.
However, I was able to reproduce the deadlock I saw by just adding this to
util.py:
--
+if __name__ == '__main__':
+ print 'running watchdog test.'
+ executeCommand(['/bin/bash',
+
'/Volumes/Data/ddunbar/llvm/utils/lit/tests/Inputs/timeout/Output/infloop.py.script'],
+ None, None, 0.1)
+ raise SystemExit
--
This was with Python 2.7.6, which might matter.
- Daniel
On Mon, Jul 6, 2015 at 8:55 AM, Jonathan Roelofs <jonathan at codesourcery.com>
wrote:
>
>
> > 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.
>
>
> How are you running the testsuite? I've been copy-pasting the command that
> the makefile runs, and adding --timeout=1 to it.
>
> > 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?
>
>
> Tested on Darwin14, and Ubuntu10.04... Seems to work there for me without
> closing the FDs. I don't have a windows box to check this on.
>
> (Python is 2.7.9 on the Darwin machine, and 2.7.3 on the Ubuntu machine.)
>
> > 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.
>
>
> This revision fixes the deadlock on kill(). Ctrl-C seems to DTRT.
>
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150706/70441a76/attachment.html>
More information about the llvm-commits
mailing list