[Piglit] [PATCH] framework/tests: add a test for the timeout mechanism
Thomas Wood
thomas.wood at intel.com
Thu Sep 25 10:13:05 PDT 2014
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
More information about the Piglit
mailing list