mirror of
https://git.yoctoproject.org/poky
synced 2026-04-03 20:02:24 +02:00
resulttool/report: Avoid divide by zero
Avoid a divide by zero traceback if unfortunate test counts are encountered. (From OE-Core rev: a46782c9f54bcb0389ea1016e37b6939aae79bfb) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit c5aeea53dfacb53dedb8445cb3523dc3a8cb6dca) Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
c739d9c97d
commit
2f5d4fa349
@@ -176,7 +176,10 @@ class ResultsTextReport(object):
|
||||
vals['sort'] = line['testseries'] + "_" + line['result_id']
|
||||
vals['failed_testcases'] = line['failed_testcases']
|
||||
for k in cols:
|
||||
vals[k] = "%d (%s%%)" % (line[k], format(line[k] / total_tested * 100, '.0f'))
|
||||
if total_tested:
|
||||
vals[k] = "%d (%s%%)" % (line[k], format(line[k] / total_tested * 100, '.0f'))
|
||||
else:
|
||||
vals[k] = "0 (0%)"
|
||||
for k in maxlen:
|
||||
if k in vals and len(vals[k]) > maxlen[k]:
|
||||
maxlen[k] = len(vals[k])
|
||||
|
||||
Reference in New Issue
Block a user