From f341e99aab9393430b588f8824ecb64fb75583d2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 24 Oct 2022 17:49:49 -0700 Subject: QPlainTestLogger: don't print "RESULT" before each additional result We do that by passing the full list of results to the logger, to a virtual that is present in the base class to call the existing function. For all but the plain logger, we'll just print multiple results. The plain logger now prints: RESULT : tst_MyClass::QString_toInt() 383 nsecs per iteration (total: 3,837,324, iterations: 10000) 1,069 CPU cycles per iteration (total: 10,692,457, iterations: 10000) 3,123 instructions per iteration (total: 31,230,101, iterations: 10000) 536 branch instructions per iteration (total: 5,360,022, iterations: 10000) Change-Id: I3c79b7e08fa346988dfefffd17203cb5802693dd Reviewed-by: Qt CI Bot Reviewed-by: Fabian Kosmale --- src/testlib/qtestcase.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/testlib/qtestcase.cpp') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 63691b0c0b..62512dc9d3 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1202,12 +1202,8 @@ void TestMethods::invokeTestOnData(int index) const bool testPassed = !QTestResult::skipCurrentTest() && !QTestResult::currentTestFailed(); QTestResult::finishedCurrentTestDataCleanup(); // Only report benchmark figures if the test passed - if (testPassed && QBenchmarkTestMethodData::current->resultsAccepted()) { - const QList median = qMedian(resultsList); - for (auto m : median) { - QTestLog::addBenchmarkResult(m); - } - } + if (testPassed && QBenchmarkTestMethodData::current->resultsAccepted()) + QTestLog::addBenchmarkResults(qMedian(resultsList)); } } -- cgit v1.2.1