diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-24 20:10:37 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-13 07:13:17 +0100 |
commit | 019588f30792132d9eca5dab11278547b287804e (patch) | |
tree | 87ef85ac726dac5235e13f45e28a811611555035 /tests/auto/testlib/selftests/tst_selftests.cpp | |
parent | 19be46414ae68c619b94f2fdebd21192898d65fd (diff) |
Testlib: Add test duration to xml output
[ChangeLog][QtTest] Added test duration to xml output.
When running tests with xml output a new tag of the form
<duration msecs="123"/> is added to each test function and the test as a
whole.
Change-Id: Ibc4db066b6acf5fac6c578f5e5ca5ce4b5d8ea8e
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Diffstat (limited to 'tests/auto/testlib/selftests/tst_selftests.cpp')
-rw-r--r-- | tests/auto/testlib/selftests/tst_selftests.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp index 15aec85bdf..97083d8d61 100644 --- a/tests/auto/testlib/selftests/tst_selftests.cpp +++ b/tests/auto/testlib/selftests/tst_selftests.cpp @@ -68,6 +68,7 @@ private: QList<LoggerSet> allLoggerSets() const; QTemporaryDir tempDir; + QRegularExpression durationRegExp; }; struct BenchmarkResult @@ -301,6 +302,7 @@ QList<LoggerSet> tst_Selftests::allLoggerSets() const tst_Selftests::tst_Selftests() : tempDir(QDir::tempPath() + "/tst_selftests.XXXXXX") + , durationRegExp("<Duration msecs=\"[\\d\\.]+\"/>") {} void tst_Selftests::initTestCase() @@ -714,6 +716,10 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge QVERIFY2(error.isEmpty(), qPrintable(QString("Expected line didn't parse as benchmark result: %1\nLine: %2").arg(error).arg(expected))); QCOMPARE(actualResult, expectedResult); + } else if (line.startsWith(" <Duration msecs=") || line.startsWith("<Duration msecs=")) { + QRegularExpressionMatch match = durationRegExp.match(line); + QVERIFY2(match.hasMatch(), qPrintable(QString::fromLatin1("Invalid Duration tag at line %1 (%2): '%3'") + .arg(i).arg(loggers.at(n), output))); } else { QVERIFY2(output == expected, qPrintable(QString::fromLatin1("Mismatch at line %1 (%2): '%3' != '%4'") |