X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgtester-report;h=5bf076ce28b405bd8989ba5ce940b60bb3bf42fc;hb=2a53b4d0e2c98a14aedf31e38f0ad1fb2e8fe26f;hp=f426826fc830211d5a47771c4a4e0456e3acf5fc;hpb=8acddd1ab4f1fb827f90c40c9fdf075dd3ceea91;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/gtester-report b/glib/gtester-report
index f426826..5bf076c 100755
--- a/glib/gtester-report
+++ b/glib/gtester-report
@@ -14,10 +14,20 @@
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
+# License along with this library; if not, see .
+import datetime
+import optparse
import sys, re, xml.dom.minidom
+
+try:
+ import subunit
+ from subunit import iso8601
+ from testtools.content import Content, ContentType
+ mime_utf8 = ContentType('text', 'plain', {'charset': 'utf8'})
+except ImportError:
+ subunit = None
+
+
pkginstall_configvars = {
#@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation
}
@@ -69,6 +79,7 @@ def html_indent_string (n):
string += uncollapsible_space
return string
+# TestBinary object, instantiated per test binary in the log file
class TestBinary:
def __init__ (self, name):
self.name = name
@@ -79,6 +90,7 @@ class TestBinary:
self.file = '???'
self.random_seed = ''
+# base class to handle processing/traversion of XML nodes
class TreeProcess:
def __init__ (self):
self.nest_level = 0
@@ -101,23 +113,35 @@ class TreeProcess:
self.trampoline (child)
self.nest_level += 1
+# test report reader, this class collects some statistics and merges duplicate test binary runs
class ReportReader (TreeProcess):
def __init__ (self):
TreeProcess.__init__ (self)
self.binary_names = []
self.binaries = {}
self.last_binary = None
+ self.info = {}
def binary_list (self):
lst = []
for name in self.binary_names:
lst += [ self.binaries[name] ]
return lst
+ def get_info (self):
+ return self.info
+ def handle_info (self, node):
+ dn = find_child (node, 'package')
+ self.info['package'] = node_as_text (dn)
+ dn = find_child (node, 'version')
+ self.info['version'] = node_as_text (dn)
+ dn = find_child (node, 'revision')
+ if dn is not None:
+ self.info['revision'] = node_as_text (dn)
def handle_testcase (self, node):
self.last_binary.testcases += [ node ]
result = attribute_as_text (node, 'result', 'status')
if result == 'success':
self.last_binary.success_cases += 1
- if bool (attribute_as_text (node, 'skipped')):
+ if bool (int (attribute_as_text (node, 'skipped') + '0')):
self.last_binary.skipped_cases += 1
def handle_text (self, node):
pass
@@ -141,7 +165,25 @@ class ReportReader (TreeProcess):
self.last_binary.random_seed = node_as_text (rseed)
self.process_children (node)
-class ReportWriter (TreeProcess):
+
+class ReportWriter(object):
+ """Base class for reporting."""
+
+ def __init__(self, binary_list):
+ self.binaries = binary_list
+
+ def _error_text(self, node):
+ """Get a string representing the error children of node."""
+ rlist = list_children(node, 'error')
+ txt = ''
+ for enode in rlist:
+ txt += node_as_text (enode)
+ if txt and txt[-1] != '\n':
+ txt += '\n'
+ return txt
+
+
+class HTMLReportWriter(ReportWriter):
# Javascript/CSS snippet to toggle element visibility
cssjs = r'''