Skip to content

Commit

Permalink
Output both global and local data tags in benchmark result header
Browse files Browse the repository at this point in the history
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.5
Fixes: QTBUG-127522
Change-Id: Ic9f3c712ef3f6858aad2546b80d8867ce860b644
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
(cherry picked from commit 95f02ad)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 7ab145a)
  • Loading branch information
Magdalena Stojek authored and Qt Cherry-pick Bot committed Dec 15, 2024
1 parent 29a793f commit f54b479
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/testlib/qplaintestlogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f54b479

Please sign in to comment.