[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / glib / gtester-report
index a0ab600..5bf076c 100755 (executable)
@@ -14,9 +14,7 @@
 # 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 <http://www.gnu.org/licenses/>.
 import datetime
 import optparse
 import sys, re, xml.dom.minidom
@@ -135,6 +133,9 @@ class ReportReader (TreeProcess):
     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')
@@ -171,7 +172,7 @@ class ReportWriter(object):
     def __init__(self, binary_list):
         self.binaries = binary_list
 
-    def _error_text(node):
+    def _error_text(self, node):
         """Get a string representing the error children of node."""
         rlist = list_children(node, 'error')
         txt = ''
@@ -239,6 +240,8 @@ class HTMLReportWriter(ReportWriter):
       self.lastchar = message[-1]
   def handle_info (self):
     self.oprint ('<h3>Package: %(package)s, version: %(version)s</h3>\n' % self.info)
+    if self.info['revision']:
+        self.oprint ('<h5>Report generated from: %(revision)s</h5>\n' % self.info)
   def handle_text (self, node):
     self.oprint (node.nodeValue)
   def handle_testcase (self, node, binary):
@@ -325,7 +328,10 @@ class HTMLReportWriter(ReportWriter):
                  (self.bcounter, self.total_tcounter, self.total_fcounter, self.total_tcounter - self.total_fcounter))
     self.oprint ('<td align="right">%f</td>\n' % self.total_duration)
     self.oprint ('<td align="center">-</td>\n')
-    perc = (self.total_tcounter - self.total_fcounter) * 100.0 / self.total_tcounter
+    if self.total_tcounter != 0:
+        perc = (self.total_tcounter - self.total_fcounter) * 100.0 / self.total_tcounter
+    else:
+        perc = 0.0
     pcolor = {
       100 : 'bgcolor="lightgreen"',
       0   : 'bgcolor="red"',
@@ -369,7 +375,7 @@ class GTestCase(object):
     """A representation of a gtester test result as a pyunit TestCase."""
 
     def __init__(self, case, binary):
-        """Create a GTestCase for case `case` from binary program `binary`."""
+        """Create a GTestCase for case 'case' from binary program 'binary'."""
         self._case = case
         self._binary = binary
         # the name of the case - e.g. /dbusmenu/glib/objects/menuitem/props_boolstr