framework/test/base.py: use subprocess32 for timeouts

Graphics / Mesa 3D Graphics Library / Piglit - Dylan Baker [gmail.com] - 21 January 2016 16:13 UTC

Subprocess32 provides a backport of python 3.2's subprocess module, which has a timeout parameter for Popen.communicate. When the timeout runs out then an exception is raised, and when that exception is caught we can kill the process.

This is fairly similar to the way the current timeout mechanism works, except that the current mechanism is not thread safe. Since one of the major features of piglit is that it offer's processes isolated concurrency of tests, it makes sense to make the effort to provide a timeout mechanism that supports concurrency. Unfortunately there isn't a good cross platform mechanism for this in python 2.x, even with subprocess 32 only *nix systems are supported, not windows.

The big advantage of this is it allows consistent behavior between python 2.x and 3.x as we look toward the future and the possibility of using a hybrid approach to transition to python 3.x while maintaining 2.x support until it's not needed.

This patch look pretty substantial. It's not as big as it looks, since it adds some fairly big tests.

09fc430 framework/test/base.py: use subprocess32 for timeouts.
framework/test/base.py | 144 ++++++++++++++++++++---------------------------
tox.ini | 2 +
unittests/base_tests.py | 119 ++++++++++++++++++++++++++++++++++++++-
3 files changed, 179 insertions(+), 86 deletions(-)

Upstream: cgit.freedesktop.org


  • Share