[Piglit] [PATCH 3/3] junit.py: Add the command line to the failing test data

Dylan Baker baker.dylan.c at gmail.com
Thu Oct 2 17:00:01 PDT 2014


This adds the test command by missusing the failure message attribute.

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
 framework/backends/junit.py       | 1 +
 framework/tests/backends_tests.py | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/framework/backends/junit.py b/framework/backends/junit.py
index 5cc0c6d..e1303b9 100644
--- a/framework/backends/junit.py
+++ b/framework/backends/junit.py
@@ -148,6 +148,7 @@ class JUnitBackend(FileBackend):
             # Add the piglit type to the failure result
             if res is not None:
                 res.attrib['type'] = str(data['result'])
+                res.attrib['message'] = str(data['command'])
 
         # Split the name of the test and the group (what junit refers to as
         # classname), and replace piglits '/' separated groups with '.', after
diff --git a/framework/tests/backends_tests.py b/framework/tests/backends_tests.py
index 177225d..d1cca08 100644
--- a/framework/tests/backends_tests.py
+++ b/framework/tests/backends_tests.py
@@ -111,6 +111,7 @@ class TestJUnitSingleTest(TestJunitNoTests):
                 'result': 'pass',
                 'out': 'this is stdout',
                 'err': 'this is stderr',
+                'command': 'this is a command -auto',
             })
         )
         test.finalize()
@@ -140,6 +141,7 @@ class TestJUnitMultiTest(TestJUnitSingleTest):
                 'result': 'pass',
                 'out': 'this is stdout',
                 'err': 'this is stderr',
+                'command': 'this is a command -auto',
             })
         )
         test.write_test(
@@ -149,6 +151,7 @@ class TestJUnitMultiTest(TestJUnitSingleTest):
                 'result': 'fail',
                 'out': 'this is stdout',
                 'err': 'this is stderr',
+                'command': 'this is a command -auto',
             })
         )
         test.finalize()
@@ -192,6 +195,7 @@ class TestJSONTestMethod(utils.StaticDirectory):
             'result': 'pass',
             'out': 'this is stdout',
             'err': 'this is stderr',
+            'command': 'this is a command -auto',
         })
         super(TestJSONTestMethod, cls).setup_class()
         test = backends.JSONBackend(cls.tdir)
@@ -227,6 +231,7 @@ class TestJSONTestFinalize(utils.StaticDirectory):
             'result': 'pass',
             'out': 'this is stdout',
             'err': 'this is stderr',
+            'command': 'this is a command -auto',
         })
         super(TestJSONTestFinalize, cls).setup_class()
         test = backends.JSONBackend(cls.tdir)
@@ -286,6 +291,7 @@ def test_junit_skips_bad_tests():
                 'result': 'pass',
                 'out': 'this is stdout',
                 'err': 'this is stderr',
+                'command': 'this is a command -auto',
             })
         )
         with open(os.path.join(tdir, 'tests', '1.xml'), 'w') as f:
-- 
2.1.1



More information about the Piglit mailing list