[Piglit] [PATCH 10/16] summary.py: Adds missing 'tests' field to junit <testsuite>

Dylan Baker baker.dylan.c at gmail.com
Thu Jun 13 08:36:17 PDT 2013


This field is required by the JUnit xsd, and was not provided. With this
change the JUnit xml being produced is valid.

xsd source: https://svn.jenkins-ci.org/trunk/hudson/dtkit/dtkit-format/
dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/
xsd/junit-4.xsd

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/summary.py | 3 ++-
 templates/junit.mako | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/framework/summary.py b/framework/summary.py
index 9ceb3ba..4adb568 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -861,5 +861,6 @@ class NewSummary:
                             output_encoding="utf-8",
                             module_directory=".makotmp")
         file = open(destination, 'w')
-        file.write(template.render(tests=xmlOutput))
+        file.write(template.render(tests=xmlOutput,
+                                   numberoftests=len(self.tests['all'])))
         file.close()
diff --git a/templates/junit.mako b/templates/junit.mako
index ef1a474..f123878 100644
--- a/templates/junit.mako
+++ b/templates/junit.mako
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <testsuites>
-  <testsuite name="piglit">
+  <testsuite name="piglit" tests="${numberoftests}">
   % for each in tests:
     <testcase classname="${each['classname']}" name="${each['testname']}" time="${each['time']}">
       <system-out>${each['system-out']}</system-out>
-- 
1.8.1.4



More information about the Piglit mailing list