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.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 5d216992d7..97458abfbf 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -104,7 +104,7 @@ inline bool qCompare
}
if (qAbs(qreal(r1.total) - qreal(r2.total)) <= qreal(r1.total)*variance) {
- return compare_helper(true, "COMPARE()", file, line);
+ return compare_helper(true, 0, 0, 0, actual, expected, file, line);
}
// Whoops, didn't match. Compare the whole string for the most useful failure message.
@@ -571,12 +571,13 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
// the actual output.
if (exp.count() == 0) {
QList<QList<QByteArray> > expArr;
+ QList<QByteArray> tmp;
int i = 1;
do {
- exp = expectedResult(subdir + QString("_%1").arg(i++), logger);
- if (exp.count())
- expArr += exp;
- } while (exp.count());
+ tmp = expectedResult(subdir + QString("_%1").arg(i++), logger);
+ if (tmp.count())
+ expArr += tmp;
+ } while (tmp.count());
for (int j = 0; j < expArr.count(); ++j) {
if (res.count() == expArr.at(j).count()) {
@@ -584,12 +585,24 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
break;
}
}
+
+ if (expArr.count()) {
+ QVERIFY2(exp.count(),
+ qPrintable(QString::fromLatin1("None of the expected output files for "
+ "%1 format has matching line count.")
+ .arg(loggers.at(n))));
+ }
} else {
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.
+ QVERIFY2(exp.count(),
+ qPrintable(QString::fromLatin1("Expected test data for %1 format is empty or not found.")
+ .arg(loggers.at(n))));
+
// For xml output formats, verify that the log is valid XML.
if (logFormat(logger) == "xunitxml" || logFormat(logger) == "xml" || logFormat(logger) == "lightxml") {
QByteArray xml(actualOutputs[n]);