diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-13 10:09:14 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-08-15 08:14:32 +0100 |
commit | c5aeea53dfacb53dedb8445cb3523dc3a8cb6dca (patch) | |
tree | 5626b46b03128a65086955820ea200053f67b8e7 /scripts | |
parent | 7b84fe344a2067b63d0c222fbc68d5916fa7903f (diff) | |
download | openembedded-core-c5aeea53dfacb53dedb8445cb3523dc3a8cb6dca.tar.gz |
resulttool/report: Avoid divide by zero
Avoid a divide by zero traceback if unfortunate test counts are encountered.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/resulttool/report.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/lib/resulttool/report.py b/scripts/lib/resulttool/report.py index f0ca50ebe2..a349510ab8 100644 --- a/scripts/lib/resulttool/report.py +++ b/scripts/lib/resulttool/report.py @@ -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]) |