summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-09-22 16:35:56 +1000
committerQt by Nokia <qt-info@nokia.com>2011-09-26 03:02:46 +0200
commitb211dd93a747340f36e45db4241c6bae50f8cee9 (patch)
treef71e97d705bf4c6fb06f5459b6f1129f0324f4de /tests
parent2bf03fa04b7b9df5078c70c95b7fd0b55bc68339 (diff)
Don't XFAIL on the contents of assert messages.
Q_ASSERT uses __FILE__, which has undefined contents, and thus the selftest cannot always match Q_ASSERT messages in actual output with those in expected output. The test was calling QEXPECT_FAIL() in this case, but doing so implies that (a) it's a failure and (b) we intend to fix it one day. Neither of these is true, so instead we should simply tolerate this difference in actual and expected outputs, in the same way that we do in a couple of other similar cases. Change-Id: I8b8609a400e9b798936875f6eb1ca18a83660efc Reviewed-on: http://codereview.qt-project.org/5358 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/testlib/selftests/tst_selftests.cpp34
1 files changed, 6 insertions, 28 deletions
diff --git a/tests/auto/testlib/selftests/tst_selftests.cpp b/tests/auto/testlib/selftests/tst_selftests.cpp
index 7c71a292c6..4ad2cdcf81 100644
--- a/tests/auto/testlib/selftests/tst_selftests.cpp
+++ b/tests/auto/testlib/selftests/tst_selftests.cpp
@@ -517,34 +517,12 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QStringList const& logge
const QString output(QString::fromLatin1(line));
const QString expected(QString::fromLatin1(exp.at(i)).replace("@INSERT_QT_VERSION_HERE@", QT_VERSION_STR));
- // Q_ASSERT uses __FILE__. Some compilers include the absolute path in
- // __FILE__, while others do not.
- if (line.contains("ASSERT") && output != expected) {
- const char msg[] = "Q_ASSERT prints out the absolute path on this platform.";
- QEXPECT_FAIL("assert old stdout txt", msg, Continue);
- QEXPECT_FAIL("assert old txt", msg, Continue);
- QEXPECT_FAIL("assert old stdout xml", msg, Continue);
- QEXPECT_FAIL("assert old xml", msg, Continue);
- QEXPECT_FAIL("assert old stdout lightxml", msg, Continue);
- QEXPECT_FAIL("assert old lightxml", msg, Continue);
- QEXPECT_FAIL("assert old stdout xunitxml", msg, Continue);
- QEXPECT_FAIL("assert old xunitxml", msg, Continue);
- QEXPECT_FAIL("assert new stdout txt", msg, Continue);
- QEXPECT_FAIL("assert new txt", msg, Continue);
- QEXPECT_FAIL("assert new stdout xml", msg, Continue);
- QEXPECT_FAIL("assert new xml", msg, Continue);
- QEXPECT_FAIL("assert new stdout lightxml", msg, Continue);
- QEXPECT_FAIL("assert new lightxml", msg, Continue);
- QEXPECT_FAIL("assert new stdout xunitxml", msg, Continue);
- QEXPECT_FAIL("assert new xunitxml", msg, Continue);
- QEXPECT_FAIL("assert stdout txt + txt", msg, Continue);
- QEXPECT_FAIL("assert xml + stdout txt", msg, Continue);
- QEXPECT_FAIL("assert txt + xunitxml", msg, Continue);
- QEXPECT_FAIL("assert lightxml + stdout xunitxml", msg, Continue);
- QEXPECT_FAIL("assert all loggers", msg, Continue);
- }
-
- if (expected.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce")) && expected != output)
+ if (subdir == "assert" && output.contains("ASSERT: ") && expected.contains("ASSERT: ") && output != expected)
+ // Q_ASSERT uses __FILE__, the exact contents of which are
+ // undefined. If we something that looks like a Q_ASSERT and we
+ // were expecting to see a Q_ASSERT, we'll skip the line.
+ continue;
+ else if (expected.startsWith(QLatin1String("FAIL! : tst_Exception::throwException() Caught unhandled exce")) && expected != output)
// On some platforms we compile without RTTI, and as a result we never throw an exception.
QCOMPARE(output.simplified(), QString::fromLatin1("tst_Exception::throwException()").simplified());
else if (output != expected && qstrcmp(QTest::currentDataTag(), "float") == 0)