aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPasi Petäjäjärvi <pasi.petajajarvi@qt.io>2023-06-20 15:30:08 +0300
committerPasi Petäjäjärvi <pasi.petajajarvi@qt.io>2023-08-15 12:14:22 +0000
commitd8c1feb99547c3b2b6ba63b2783330ef94a61ce3 (patch)
tree8f658a1293c49c7eeb531fbd4d95f197b9424925
parent7704cea87e6f77aeaac3c875e83f92011115de9c (diff)
Print sensible information when compared test result is zero
We cannot calculate percentage improvement from zero, so instead print message stating this with test result it's being compared. Change-Id: Icea838931782fa661ddec505f5dd2ce1377e5a51 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--tools/compareresults/main.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/compareresults/main.cpp b/tools/compareresults/main.cpp
index c387be7..94d25c0 100644
--- a/tools/compareresults/main.cpp
+++ b/tools/compareresults/main.cpp
@@ -156,7 +156,9 @@ int main(int argc, char **argv)
const double differenceInPercent = (newValue - oldValue) * 100 / oldValue;
- if (differenceInPercent > 0) {
+ if (differenceInPercent == INFINITY) {
+ printf("Reference testrun result for %s was zero. New result is %.f\n", qPrintable(testName), newValue);
+ } else if (differenceInPercent > 0) {
printf("%s: improvement by %.2f%%\n", qPrintable(testName), differenceInPercent);
} else if (differenceInPercent < 0) {
printf("%s: regression by %.2f%%\n", qPrintable(testName), differenceInPercent);