From: Robert Collins Date: Tue, 15 Jun 2010 05:49:44 +0000 (-0400) Subject: Add subunit support to gtester-report X-Git-Tag: 2.25.9~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f9e8b5d9d47859c7bb62430753ce77e981e4ee65;p=platform%2Fupstream%2Fglib.git Add subunit support to gtester-report This patch adds subunit support to gtester-report via a -s switch. Subunit (https://launchpad.net/subunit) is a language neutral test activity protocol. This can be used to integrate gtester tests with the Hudson CI tool amongst other things. Bug #611869. --- diff --git a/glib/gtester-report b/glib/gtester-report index 52b9dcb..a0ab600 100755 --- a/glib/gtester-report +++ b/glib/gtester-report @@ -17,8 +17,19 @@ # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. +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 } @@ -153,8 +164,25 @@ class ReportReader (TreeProcess): self.last_binary.random_seed = node_as_text (rseed) self.process_children (node) -# HTML report generation class -class ReportWriter (TreeProcess): + +class ReportWriter(object): + """Base class for reporting.""" + + def __init__(self, binary_list): + self.binaries = binary_list + + def _error_text(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'''