gtester-report: cope with binaries with no test cases

It's possible that a given binary may conditionally decided not to run
any test cases (e.g. since they are all slow but -m=quick is currently
in use) In this case the xml may contain <testbinary> nodes with no
<testcase> children. This was resulting in a divide by zero when
calculating the green → red color interpolation.

https://bugzilla.gnome.org/show_bug.cgi?id=617914
This commit is contained in:
Robert Bragg 2010-05-06 15:46:00 +01:00
parent 7ca2e00054
commit 03b5db4477

View File

@ -268,6 +268,7 @@ class ReportWriter (TreeProcess):
erlink = 'href="javascript:toggle_display (\'ResultTable\', \'tr\', \'b%u_\', \'failed\')"' % self.bcounter
if binary.success_cases:
oklink = 'href="javascript:toggle_display (\'ResultTable\', \'tr\', \'b%u_\', \'success\')"' % self.bcounter
if real_cases != 0:
self.oprint ('<a %s>ER</a>\n' % erlink)
self.oprint ('<a %s>OK</a>\n' % oklink)
self.oprint ('</td>\n')
@ -278,6 +279,10 @@ class ReportWriter (TreeProcess):
}.get (int (perc), 'bgcolor="yellow"')
self.oprint ('<td align="right" %s>%.2f%%</td>\n' % (pcolor, perc))
self.oprint ('</tr>\n')
else:
self.oprint ('Empty\n')
self.oprint ('</td>\n')
self.oprint ('</tr>\n')
for tc in binary.testcases:
self.handle_testcase (tc, binary)
def handle_totals (self):