This allows tests to set a per instance timeout in the class initializer, which means it can be done in all.py from the adder function by specifying a timeout value. If the timeout value is not set then it falls back to the class value, which is either None (from the base Test class) or a value set in one of Test's Children.
This fixes fp-indirections and max-varyings on my haswell (which take longer than the 30 seconds provided by PiglitGLTest) Signed-off-by: Dylan Baker <[email protected]> --- framework/test/base.py | 7 ++++++- framework/tests/base_tests.py | 15 +++++++++++++++ tests/all.py | 4 ++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/framework/test/base.py b/framework/test/base.py index f06fb99..460ad99 100644 --- a/framework/test/base.py +++ b/framework/test/base.py @@ -67,7 +67,7 @@ class Test(object, metaclass=abc.ABCMeta): '_test_hook_execute_run'] timeout = None - def __init__(self, command, run_concurrent=False): + def __init__(self, command, run_concurrent=False, timeout=None): assert isinstance(command, list), command self.run_concurrent = run_concurrent @@ -75,6 +75,11 @@ class Test(object, metaclass=abc.ABCMeta): self.env = {} self.result = TestResult({'result': 'fail'}) self.cwd = None + if timeout is not None: + # If no timeout is specified this will fallback to the class value + # XXX: can this actually be a float? + assert isinstance(timeout, (int, float)) + self.timeout = timeout # pylint: disable=assigning-non-slot # This is a hook for doing some testing on execute right before # self.run is called. diff --git a/framework/tests/base_tests.py b/framework/tests/base_tests.py index 6d99a76..9fa9e65 100644 --- a/framework/tests/base_tests.py +++ b/framework/tests/base_tests.py @@ -36,6 +36,7 @@ class TestTest(Test): self.test_interpret_result name """ + timeout = 120 test_interpret_result = lambda: None def interpret_result(self): @@ -155,3 +156,17 @@ def test_mutation(): _Test(args) nt.assert_list_equal(args, ['a', 'b']) + + [email protected](3) +def test_override_timeout(): + """Test: overriding timeout on a per instance basis works. + + Since TestTest has a timeout of 120 seconds, and the test defined here + should run 60 seconds, and we set a timeout of 1 second we expect this test + to take less than 3 seconds (to give some setup flexability) if it goes + over that it is a failure. + + """ + test = TestTest(['sleep', '60'], timeout=1) + test.run() diff --git a/tests/all.py b/tests/all.py index 0cfcd8e..ffc0015 100644 --- a/tests/all.py +++ b/tests/all.py @@ -1838,7 +1838,7 @@ with profile.group_manager( g(['fp-formats'], run_concurrent=False) g(['fp-fragment-position'], run_concurrent=False) g(['fp-incomplete-tex'], run_concurrent=False) - g(['fp-indirections'], run_concurrent=False) + g(['fp-indirections'], run_concurrent=False, timeout=60) g(['fp-indirections2'], run_concurrent=False) g(['fp-kil'], run_concurrent=False) g(['fp-lit-mask'], run_concurrent=False) @@ -3227,7 +3227,7 @@ with profile.group_manager( 'immediate-reuse-index-buffer') g(['ext_transform_feedback-immediate-reuse-uniform-buffer'], 'immediate-reuse-uniform-buffer') - g(['ext_transform_feedback-max-varyings'], 'max-varyings') + g(['ext_transform_feedback-max-varyings'], 'max-varyings', timeout=60) g(['ext_transform_feedback-nonflat-integral'], 'nonflat-integral') g(['ext_transform_feedback-overflow-edge-cases'], 'overflow-edge-cases') g(['ext_transform_feedback-overflow-edge-cases', 'use_gs'], -- 2.3.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
