summaryrefslogtreecommitdiff
path: root/tests/auto/xmlpatterns
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-03 13:40:09 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-09-03 12:48:38 +0000
commit3510040dc99a8266963c5e8ce10c2bd0edaaaf76 (patch)
tree86054812e982a69ef287d89d9b8f40c0a406eb08 /tests/auto/xmlpatterns
parentd7aff0febb4101084e9efb8e76cf4f5d7533c047 (diff)
downloadqtxmlpatterns-3510040dc99a8266963c5e8ce10c2bd0edaaaf76.tar.gz
xmlpatterns test: Improve process handling.
Introduce a message when starting fails or timeouts occur and flip the order to check for timeouts first and then check the exit code. Change-Id: I293aa55888186f66c12cd86bcb8010802f521032 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/xmlpatterns')
-rw-r--r--tests/auto/xmlpatterns/tst_xmlpatterns.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
index 85dc50a..90bfbe3 100644
--- a/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
+++ b/tests/auto/xmlpatterns/tst_xmlpatterns.cpp
@@ -119,6 +119,17 @@ void tst_XmlPatterns::initTestCase()
#endif // QT_NO_PROCESS
}
+#ifndef QT_NO_PROCESS
+static QByteArray msgProcessError(const char *what, const QProcess &process)
+{
+ QString result = QLatin1String(what) + QLatin1Char(' ')
+ + QDir::toNativeSeparators(process.program())
+ + QLatin1Char(' ') + process.arguments().join(QLatin1Char(' '))
+ + QLatin1String(": ") + process.errorString();
+ return result.toLocal8Bit();
+}
+#endif // !QT_NO_PROCESS
+
void tst_XmlPatterns::xquerySupport()
{
if (QTest::currentDataTag() == QByteArray("Load query via FTP")
@@ -145,9 +156,10 @@ void tst_XmlPatterns::xquerySupport()
process.setWorkingDirectory(inputFile(cwd));
process.start(m_command, arguments);
+ QVERIFY2(process.waitForStarted(), msgProcessError("Failed to start", process).constData());
+ QVERIFY2(process.waitForFinished(), msgProcessError("Timeout running", process).constData());
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
- QVERIFY(process.waitForFinished());
if(process.exitCode() != expectedExitCode)
QTextStream(stderr) << "stderr:" << process.readAllStandardError();