summaryrefslogtreecommitdiffstats
path: root/tests/auto/testlib/selftests/tst_selftests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/testlib/selftests/tst_selftests.cpp')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index e332f01861..c2265ad198 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
@@ -99,13 +100,13 @@ inline bool qCompare
// Now check the value. Some variance is allowed, and how much depends on
// the measured unit.
qreal variance = 0.;
- if (r1.unit == "msec") {
+ if (r1.unit == "msecs" || r1.unit == "WalltimeMilliseconds") {
variance = 0.1;
}
else if (r1.unit == "instruction reads") {
variance = 0.001;
}
- else if (r1.unit == "ticks") {
+ else if (r1.unit == "CPU ticks" || r1.unit == "CPUTicks") {
variance = 0.001;
}
if (variance == 0.) {
@@ -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()
@@ -381,6 +383,10 @@ void tst_Selftests::runSubTest_data()
<< "subtest"
<< "verbose1"
<< "verbose2"
+#ifndef QT_NO_EXCEPTIONS
+ // this test will test nothing if the exceptions are disabled
+ << "verifyexceptionthrown"
+#endif //!QT_NO_EXCEPTIONS
<< "warnings"
<< "xunit"
;
@@ -480,6 +486,8 @@ void tst_Selftests::runSubTest_data()
continue;
}
}
+ if (subtest == "badxml" && (loggerSet.name == "all loggers" || loggerSet.name.contains("txt")))
+ continue; // XML only, do not mix txt and XML for encoding test.
const bool crashes = subtest == QLatin1String("assert") || subtest == QLatin1String("exceptionthrow")
|| subtest == QLatin1String("fetchbogus") || subtest == QLatin1String("crashedterminate")
|| subtest == QLatin1String("crashes") || subtest == QLatin1String("silent");
@@ -633,9 +641,19 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
.arg(loggers.at(n))));
}
} else {
- QVERIFY2(res.count() == exp.count(),
+ if (res.count() != exp.count()) {
+ qDebug() << "<<<<<<";
+ foreach (const QByteArray &line, res)
+ qDebug() << line;
+ qDebug() << "======";
+ foreach (const QByteArray &line, exp)
+ qDebug() << line;
+ qDebug() << ">>>>>>";
+
+ QVERIFY2(res.count() == exp.count(),
qPrintable(QString::fromLatin1("Mismatch in line count: %1 != %2 (%3).")
.arg(res.count()).arg(exp.count()).arg(loggers.at(n))));
+ }
}
// By this point, we should have loaded a non-empty expected data file.
@@ -700,6 +718,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'")