[Piglit] [PATCH] framework/tests: add a test for the timeout mechanism

Dylan Baker baker.dylan.c at gmail.com
Fri Sep 26 15:30:48 PDT 2014


I'd prefer this split into two seperate tests, but it's fine either way

Reviewed-by: Dylan Baker <baker.dylan.c at gmail.com>

On Thursday, September 25, 2014 06:13:05 PM Thomas Wood wrote:
> Signed-off-by: Thomas Wood <thomas.wood at intel.com>
> ---
>  framework/tests/exectest_test.py | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/framework/tests/exectest_test.py b/framework/tests/exectest_test.py
> index 935719d..ebe02a4 100644
> --- a/framework/tests/exectest_test.py
> +++ b/framework/tests/exectest_test.py
> @@ -56,6 +56,26 @@ def test_run_return_early():
>      test.run()
>  
>  
> +def test_timeout():
> +    """ Test that Test.timeout works correctly """
> +
> +    def helper():
> +        if (test.result['returncode'] == 0):
> +            test.result['result'] = "pass"
> +
> +    test = TestTest("/usr/bin/sleep 60")
> +    test.test_interpret_result = helper
> +    test.timeout = 1
> +    test.run()
> +    assert test.result['result'] == 'timeout'
> +
> +    test = TestTest("/usr/bin/true")
> +    test.test_interpret_result = helper
> +    test.timeout = 1
> +    test.run()
> +    assert test.result['result'] == 'pass'
> +
> +
>  def test_piglittest_interpret_result():
>      """ PiglitTest.interpret_result() works no subtests """
>      test = PiglitTest('foo')
> -- 
> 2.1.0
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/piglit/attachments/20140926/e6c4139f/attachment.sig>


More information about the Piglit mailing list