[Piglit] [PATCH] framework: Add a PIGLIT_TEST_TIMEOUT environment variable

Jason Ekstrand jason at jlekstrand.net
Fri Jun 8 19:01:01 UTC 2018


This commit adds a new PIGLIT_TESTS_TIMEOUT environment variable which
overrides the pre-test timeout specified by the test runner.
---

This is almost certainly not the right solution but it gets the discussion
started.  A couple of known issues:

 - No documentation
 - It overrides.  Maybe it should be a max timeout?
 - Maybe we want a flag instead of an environment variable?
 - Maybe Jason has no clue what he's doing inside the piglit framework and
   someone else should write the patch?

Comments welcome!

--Jason


 framework/test/base.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/framework/test/base.py b/framework/test/base.py
index f187c0210..43bbacd51 100644
--- a/framework/test/base.py
+++ b/framework/test/base.py
@@ -118,6 +118,8 @@ __all__ = [
 # PIGLIT_NO_TIMEOUT to anything that bool() will resolve as True
 _SUPPRESS_TIMEOUT = bool(os.environ.get('PIGLIT_NO_TIMEOUT', False))
 
+# Default timeout
+_USER_TEST_TIMEOUT = int(os.environ.get('PIGLIT_TEST_TIMEOUT', 0))
 
 class TestIsSkip(exceptions.PiglitException):
     """Exception raised in is_skip() if the test is a skip."""
@@ -343,7 +345,11 @@ class Test(object):
 
             self.result.pid.append(proc.pid)
             if not _SUPPRESS_TIMEOUT:
-                out, err = proc.communicate(timeout=self.timeout)
+                if _USER_TEST_TIMEOUT:
+                    timeout = _USER_TEST_TIMEOUT
+                else:
+                    timeout = self.timeout
+                out, err = proc.communicate(timeout=timeout)
             else:
                 out, err = proc.communicate()
             returncode = proc.returncode
-- 
2.17.1



More information about the Piglit mailing list