diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-04-29 21:21:42 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-04-30 16:57:23 -0400 |
commit | a7053a6c04496fa26a62bb3824ccc9664909a6ec (patch) | |
tree | 14db0cddfc035bc5f423d39b5a5ae20cf9609342 /testsuite/driver | |
parent | b57b5b929bbb287b8392bfd015bf6adccdfac875 (diff) | |
download | haskell-a7053a6c04496fa26a62bb3824ccc9664909a6ec.tar.gz |
Testsuite driver: don't crash on empty metrics
The testsuite driver crashed when trying to display minimum/maximum
performance changes when there are no metrics (i.e. there is
no baseline available). This patch fixes that.
Diffstat (limited to 'testsuite/driver')
-rw-r--r-- | testsuite/driver/runtests.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 6a68b67714..a7abfdf3b9 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -425,13 +425,17 @@ def tabulate_metrics(metrics: List[PerfMetric]) -> None: for x in metrics if x.baseline is not None ] + minimum = 0.0 + maximum = 0.0 + if len(changes) > 0: + minimum = 100 * (min(changes) - 1) + maximum = 100 * (max(changes) - 1) dataRows += [ row(("", "", "", "", "", "", "", "")), row(("geo. mean", "", "", "", "", "", "{:+4.1f}%".format(100*(geometric_mean(changes)-1)), "")), - row(("minimum ", "", "", "", "", "", "{:+4.1f}%".format(100*(min(changes)-1)), "")), - row(("maximum ", "", "", "", "", "", "{:+4.1f}%".format(100*(max(changes)-1)), "")), + row(("minimum ", "", "", "", "", "", "{:+4.1f}%".format(minimum), "")), + row(("maximum ", "", "", "", "", "", "{:+4.1f}%".format(maximum), "")), ] - print_table(headerRows, dataRows, 1) print("") if hasBaseline: |