[Piglit] [PATCH 1/3] exectest_test.py: Add a unit test for the expanding running bug

Dylan Baker baker.dylan.c at gmail.com
Thu Oct 2 14:31:09 PDT 2014


There is a bug right now that is present in the quite (and by
inheritance verbose) logger, which causes a test that uses the default
status to assert and the thread closes. When this happens the logger
doesn't finish, and the running line isn't removed.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/tests/exectest_test.py | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/framework/tests/exectest_test.py b/framework/tests/exectest_test.py
index 3610093..3579251 100644
--- a/framework/tests/exectest_test.py
+++ b/framework/tests/exectest_test.py
@@ -21,7 +21,10 @@
 """ Tests for the exectest module """
 
 import nose.tools as nt
+
 from framework.exectest import PiglitTest, Test
+from framework.log import LogManager
+from framework.dmesg import DummyDmesg
 
 
 # Helpers
@@ -112,3 +115,27 @@ def test_piglitest_no_clobber():
 
     nt.assert_dict_equal(test.result['subtest'],
                          {'test1': 'pass', 'test2': 'pass'})
+
+
+def test_log_expanding_running():
+    """Test.execute(): When a test fails the default value is valid.
+
+    This exercises a bug where the default value is a status.Status object,
+    which causes a failure in the logger. Because of the way that python
+    handles thread exceptions the thread dies, and the number is left in the
+    running tests.
+
+    """
+    class _Test(Test):
+        """Class for testing execute() default value."""
+        def run(self):
+            pass
+
+        def interpret_result(self):
+            raise AssertionError('run did not return')
+
+    manager = LogManager('quiet', 5)
+
+    test = _Test('foo')
+    test.execute('foo', manager.get(), DummyDmesg())
+    nt.assert_list_equal(manager._state['running'], [])
-- 
2.1.1



More information about the Piglit mailing list