summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMagdalena Stojek <[email protected]>2024-12-12 14:17:37 +0100
committerMagdalena Stojek <[email protected]>2024-12-13 19:04:27 +0100
commit95f02adf756d1ae485f39a060c6f23a5af3f64ee (patch)
tree34c2f58cecba6ab619881e19041c0fcac07431a9
parent1318232c051084d2734d426a8c4f2b6d22a245d7 (diff)
Output both global and local data tags in benchmark result header
Modified QPlainTestLogger::printBenchmarkResultsHeader() to concatenate and display both global and local data tags, in the benchmark result header, in the format `global:local`. If only one tag is available, it is printed alone. Pick-to: 6.9 6.8 6.5 Fixes: QTBUG-127522 Change-Id: Ic9f3c712ef3f6858aad2546b80d8867ce860b644 Reviewed-by: Matthias Rauter <[email protected]>
-rw-r--r--src/testlib/qplaintestlogger.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/testlib/qplaintestlogger.cpp b/src/testlib/qplaintestlogger.cpp
index 250015f7d62..5cb3f7dadc5 100644
--- a/src/testlib/qplaintestlogger.cpp
+++ b/src/testlib/qplaintestlogger.cpp
@@ -301,8 +301,15 @@ void QPlainTestLogger::printBenchmarkResultsHeader(const QBenchmarkResult &resul
buf.appendf("%s: %s::%s", QTest::benchmarkResult2String(),
QTestResult::currentTestObjectName(), result.context.slotName.toLatin1().data());
- if (QByteArray tag = result.context.tag.toLocal8Bit(); !tag.isEmpty())
- buf.appendf(":\"%s\":\n", tag.data());
+ QByteArray tag = QTestResult::currentDataTag();
+ QByteArray gtag = QTestResult::currentGlobalDataTag();
+
+ if (!gtag.isEmpty() && !tag.isEmpty())
+ buf.appendf(":\"%s:%s\":\n", gtag.constData(), tag.constData());
+ else if (!gtag.isEmpty())
+ buf.appendf(":\"%s\":\n", gtag.constData());
+ else if (!tag.isEmpty())
+ buf.appendf(":\"%s\":\n", tag.constData());
else
buf.append(":\n");
outputMessage(buf);