summaryrefslogtreecommitdiffstats
path: root/tests/auto/selftests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2009-05-06 00:31:28 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2009-05-06 01:04:29 (GMT)
commit2d194009379a4e199ec246ca053ee97ee733482f (patch)
tree2ed191e8864508e957c80ed455be7e8e62e7c67a /tests/auto/selftests
parentd32782a91982c50c72aed170f3bab2024ff8b4f3 (diff)
downloadQt-2d194009379a4e199ec246ca053ee97ee733482f.zip
Qt-2d194009379a4e199ec246ca053ee97ee733482f.tar.gz
Qt-2d194009379a4e199ec246ca053ee97ee733482f.tar.bz2
Made tst_Selftests::checkXML actually test the new (Qt 4.6) test logger.
Previously `-flush' was always passed to the child process, meaning the old (Qt 4.5) test logger was used exclusively in this test, hiding bugs.
Diffstat (limited to 'tests/auto/selftests')
-rw-r--r--tests/auto/selftests/badxml/tst_badxml.cpp7
-rw-r--r--tests/auto/selftests/tst_selftests.cpp63
2 files changed, 42 insertions, 28 deletions
diff --git a/tests/auto/selftests/badxml/tst_badxml.cpp b/tests/auto/selftests/badxml/tst_badxml.cpp
index 6b2e4c4..fa5b717 100644
--- a/tests/auto/selftests/badxml/tst_badxml.cpp
+++ b/tests/auto/selftests/badxml/tst_badxml.cpp
@@ -58,6 +58,8 @@ private slots:
void badMessage() const;
void badMessage_data() const;
+ void failWithNoFile() const;
+
public:
static QList<QByteArray> const& badStrings();
};
@@ -116,6 +118,11 @@ void tst_BadXml::badDataTag_data() const
}
}
+void tst_BadXml::failWithNoFile() const
+{
+ QTest::qFail("failure message", 0, 0);
+}
+
/*
Outputs a message containing a bad string.
*/
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index aa1048b..d4069b1 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -324,34 +324,41 @@ void tst_Selftests::checkXML() const
if(m_checkXMLBlacklist.contains(subdir))
return;
- arguments.prepend("-xml");
- arguments.prepend("-flush");
-
- QProcess proc;
- proc.setEnvironment(QStringList(""));
- proc.start(subdir + "/" + subdir, arguments);
- QVERIFY(proc.waitForFinished());
-
- QByteArray out(proc.readAllStandardOutput());
- QByteArray err(proc.readAllStandardError());
-
- /* Some platforms decides to output a message for uncaught exceptions. For instance,
- * this is what windows platforms says:
- * "This application has requested the Runtime to terminate it in an unusual way.
- * Please contact the application's support team for more information." */
- if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus"))
- QVERIFY2(err.isEmpty(), err.constData());
-
- QXmlStreamReader reader(out);
-
- while(!reader.atEnd())
- reader.readNext();
-
- QVERIFY2(!reader.error(), qPrintable(QString("line %1, col %2: %3")
- .arg(reader.lineNumber())
- .arg(reader.columnNumber())
- .arg(reader.errorString())
- ));
+ QStringList args;
+ /* Test both old (-flush) and new XML logger implementation */
+ for (int i = 0; i < 2; ++i) {
+ bool flush = i;
+ args = arguments;
+ args.prepend("-xml");
+ if (flush) args.prepend("-flush");
+
+ QProcess proc;
+ proc.setEnvironment(QStringList(""));
+ proc.start(subdir + "/" + subdir, args);
+ QVERIFY(proc.waitForFinished());
+
+ QByteArray out(proc.readAllStandardOutput());
+ QByteArray err(proc.readAllStandardError());
+
+ /* Some platforms decides to output a message for uncaught exceptions. For instance,
+ * this is what windows platforms says:
+ * "This application has requested the Runtime to terminate it in an unusual way.
+ * Please contact the application's support team for more information." */
+ if(subdir != QLatin1String("exception") && subdir != QLatin1String("fetchbogus"))
+ QVERIFY2(err.isEmpty(), err.constData());
+
+ QXmlStreamReader reader(out);
+
+ while(!reader.atEnd())
+ reader.readNext();
+
+ QVERIFY2(!reader.error(), qPrintable(QString("(flush %0) line %1, col %2: %3")
+ .arg(flush)
+ .arg(reader.lineNumber())
+ .arg(reader.columnNumber())
+ .arg(reader.errorString())
+ ));
+ }
}
void tst_Selftests::checkXunitxml() const