X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgtester-report;h=5bf076ce28b405bd8989ba5ce940b60bb3bf42fc;hb=20f6cc2a10ba26860e7a6d27c100deadb5497772;hp=c2250e35ce1edf648e3e9d153d7b9091b0f80a7d;hpb=046e521b4f08a88c889620225faea7284356eb23;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/gtester-report b/glib/gtester-report
index c2250e3..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
}
@@ -110,11 +120,22 @@ class ReportReader (TreeProcess):
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')
@@ -144,8 +165,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(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'''