diff --git a/tests/auto/selftests/expected_assert.lightxml b/tests/auto/selftests/expected_assert.lightxml
index 9062ca69a8..c9a1978e9e 100644
--- a/tests/auto/selftests/expected_assert.lightxml
+++ b/tests/auto/selftests/expected_assert.lightxml
@@ -10,7 +10,7 @@
-
+
diff --git a/tests/auto/selftests/expected_assert.txt b/tests/auto/selftests/expected_assert.txt
index 0203f2b74e..f57eb55604 100644
--- a/tests/auto/selftests/expected_assert.txt
+++ b/tests/auto/selftests/expected_assert.txt
@@ -2,7 +2,7 @@
Config: Using QTest library 4.3.0, Qt 4.3.0
PASS : tst_Assert::initTestCase()
PASS : tst_Assert::testNumber1()
-QFATAL : tst_Assert::testNumber2() ASSERT: "false" in file /home/fenglich/dev/qt-4.3/tests/auto/selftests/assert/tst_assert.cpp, line 29
+QFATAL : tst_Assert::testNumber2() ASSERT: "false" in file tst_assert.cpp, line 62
FAIL! : tst_Assert::testNumber2() Received a fatal error.
Loc: [Unknown file(0)]
Totals: 2 passed, 1 failed, 0 skipped
diff --git a/tests/auto/selftests/expected_assert.xml b/tests/auto/selftests/expected_assert.xml
index 3a7152c71a..60085aa2b9 100644
--- a/tests/auto/selftests/expected_assert.xml
+++ b/tests/auto/selftests/expected_assert.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/tests/auto/selftests/expected_assert.xunitxml b/tests/auto/selftests/expected_assert.xunitxml
index 2a7d5ebce8..87617003c5 100644
--- a/tests/auto/selftests/expected_assert.xunitxml
+++ b/tests/auto/selftests/expected_assert.xunitxml
@@ -7,10 +7,10 @@
-
+
-
+
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 320d993426..cb5cd077b6 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -416,13 +416,16 @@ void tst_Selftests::doRunSubTest(QString const& subdir, QString const& logger, Q
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) {
- QEXPECT_FAIL("assert", "QTestLib prints out the absolute path.", Continue);
- QEXPECT_FAIL("assert xml", "QTestLib prints out the absolute path.", Continue);
- QEXPECT_FAIL("assert xml flush", "QTestLib prints out the absolute path.", Continue);
- QEXPECT_FAIL("assert lightxml", "QTestLib prints out the absolute path.", Continue);
- QEXPECT_FAIL("assert lightxml flush", "QTestLib prints out the absolute path.", Continue);
- QEXPECT_FAIL("assert xunitxml", "QTestLib prints out the absolute path.", Continue);
+ const char msg[] = "Q_ASSERT prints out the absolute path on this platform.";
+ QEXPECT_FAIL("assert", msg, Continue);
+ QEXPECT_FAIL("assert xml", msg, Continue);
+ QEXPECT_FAIL("assert xml flush", msg, Continue);
+ QEXPECT_FAIL("assert lightxml", msg, Continue);
+ QEXPECT_FAIL("assert lightxml flush", msg, Continue);
+ QEXPECT_FAIL("assert xunitxml", msg, Continue);
}
/* On some platforms we compile without RTTI, and as a result we never throw an exception. */