[PATCH 1/2] TestPlan: Use info and warning message

Rick Walsh rickmwalsh at gmail.com
Sat Aug 29 16:18:59 PDT 2015


Using the functions qInfo, qWarning and QWARN to report differences in expected
runtime results makes the output clearer, and warns rather than fails when we
have made small changes, hopefully improvements, such that the calculated
runtime varies a little from the known Subsurface runtime.

Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
---
 tests/testplan.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/testplan.cpp b/tests/testplan.cpp
index 3535f9d..56d511b 100644
--- a/tests/testplan.cpp
+++ b/tests/testplan.cpp
@@ -213,18 +213,20 @@ bool compareDecoTime(int actualRunTimeSeconds, int benchmarkRunTimeSeconds, int
 		int totalDifferenceAllowed = 0.001 * permilDifferenceAllowed * benchmarkRunTimeSeconds + absoluteDifferenceAllowedSeconds;
 		int totalDifference = abs(actualRunTimeSeconds - benchmarkRunTimeSeconds);
 
-		printf("Calculated run time = %d seconds\n", actualRunTimeSeconds);
-		printf("Expected run time = %d seconds\n", benchmarkRunTimeSeconds);
-		printf("Allowed time difference is %g percent plus %d seconds = %d seconds\n",
+		qInfo("Calculated run time = %d seconds", actualRunTimeSeconds);
+		qInfo("Expected run time = %d seconds", benchmarkRunTimeSeconds);
+		qInfo("Allowed time difference is %g percent plus %d seconds = %d seconds",
 		       permilDifferenceAllowed * 0.1, absoluteDifferenceAllowedSeconds, totalDifferenceAllowed);
-		printf("total difference = %d seconds\n", totalDifference);
+		qInfo("total difference = %d seconds", totalDifference);
 
 		bool result = (totalDifference <= totalDifferenceAllowed);
 	}
-	if (actualRunTimeSeconds == knownSsrfRunTimeSeconds)
-		return result;
-	else
-		return false;
+	if ((knownSsrfRunTimeSeconds > 0) && (actualRunTimeSeconds != knownSsrfRunTimeSeconds)) {
+		QWARN("Calculated run time does not match known Subsurface runtime");
+		qWarning("Calculated runtime: %d", actualRunTimeSeconds);
+		qWarning("Known Subsurface runtime: %d", knownSsrfRunTimeSeconds);
+	}
+	return result;
 }
 
 void TestPlan::testMetric()
-- 
2.4.3



More information about the subsurface mailing list