[Piglit] [PATCH 1/2] unittests: Add a test case to ensure subtests don't mask crashes

Dylan Baker dylan at pnwbakers.com
Mon May 9 21:46:50 UTC 2016


Currently a test can crash, but if some subtests have a better status
then the status will be the worst of the subtests. This isn't correct
behavior because 'crash' is a framework generated status, not a status
that the runner itself generates.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 unittests/results_tests.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/unittests/results_tests.py b/unittests/results_tests.py
index 7cdb849..466f1e4 100644
--- a/unittests/results_tests.py
+++ b/unittests/results_tests.py
@@ -185,6 +185,19 @@ def test_TestResult_result_getter_subtests():
     nt.eq_(test.result, 'incomplete')
 
 
+def test_TestResult_result_getters_subtests_crash():
+    """results.TestResult.result.__get__: doesn't mask crashes.
+
+    Crash is somewhat unique in that subtests can run and pass, but then the
+    test can crash before all subtests have been run.
+
+    """
+    test = results.TestResult('crash')
+    test.subtests['a'] = 'pass'
+    test.subtests['b'] = 'skip'
+    nt.eq_(test.result, 'crash')
+
+
 def test_TestResult_result_setter():
     """results.TestResult.result: setter makes the result a status"""
     test = results.TestResult('pass')
-- 
2.8.2



More information about the Piglit mailing list