summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-03-23 08:29:43 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2016-03-23 08:29:43 +0100
commit8e2d3e3b90d7d35d2c91fc09ab5a9cccac0823e8 (patch)
treefe20315ed91d4babd73df69ece0af1d1550cb40c /tests/auto/corelib/io/qprocess/tst_qprocess.cpp
parentbf17e30c8e98b311cdee397f1272e70863247ebc (diff)
parentf319b9b43c313dfa306a62c391e767bc6f14bdee (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp')
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp38
1 files changed, 10 insertions, 28 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index c47e88b0e6..1f0ace0dd3 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -40,8 +40,6 @@
#include <QtNetwork/QHostInfo>
#include <stdlib.h>
-# include <private/qprocess_p.h> // only so we get QPROCESS_USE_SPAWN
-
typedef void (QProcess::*QProcessFinishedSignal1)(int);
typedef void (QProcess::*QProcessFinishedSignal2)(int, QProcess::ExitStatus);
typedef void (QProcess::*QProcessErrorSignal)(QProcess::ProcessError);
@@ -321,9 +319,6 @@ void tst_QProcess::startDetached()
{
QVERIFY(QProcess::startDetached("testProcessNormal/testProcessNormal",
QStringList() << "arg1" << "arg2"));
-#ifdef QPROCESS_USE_SPAWN
- QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
-#endif
QCOMPARE(QProcess::startDetached("nonexistingexe"), false);
}
@@ -706,9 +701,6 @@ void tst_QProcess::waitForFinished()
QCOMPARE(output.count("\n"), 10*1024);
process.start("blurdybloop");
-#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
- QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort);
-#endif
QVERIFY(!process.waitForFinished());
QCOMPARE(process.error(), QProcess::FailedToStart);
}
@@ -921,6 +913,16 @@ void tst_QProcess::hardExit()
#endif
QVERIFY2(proc.waitForStarted(), qPrintable(proc.errorString()));
+
+#if defined(Q_OS_QNX)
+ // QNX may lose the kill if it's delivered while the forked process
+ // is doing the exec that morphs it into testProcessEcho. It's very
+ // unlikely that a normal application would do such a thing. Make
+ // sure the test doesn't accidentally try to do it.
+ proc.write("A");
+ QVERIFY(proc.waitForReadyRead(5000));
+#endif
+
proc.kill();
QVERIFY(proc.waitForFinished(5000));
@@ -1524,11 +1526,6 @@ void tst_QProcess::createProcessArgumentsModifier()
void tst_QProcess::exitCodeTest()
{
for (int i = 0; i < 255; ++i) {
-#ifdef QPROCESS_USE_SPAWN
- // POSIX reserves exit code 127 when using posix_spawn
- if (i == 127)
- continue;
-#endif
QProcess process;
process.start("testExitCodes/testExitCodes " + QString::number(i));
QVERIFY(process.waitForFinished(5000));
@@ -1539,9 +1536,6 @@ void tst_QProcess::exitCodeTest()
void tst_QProcess::failToStart()
{
-#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
- QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
-#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
@@ -1612,9 +1606,6 @@ void tst_QProcess::failToStart()
void tst_QProcess::failToStartWithWait()
{
-#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
- QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
-#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
@@ -1644,9 +1635,6 @@ void tst_QProcess::failToStartWithWait()
void tst_QProcess::failToStartWithEventLoop()
{
-#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
- QSKIP("QProcess cannot detect failure to start when using posix_spawn()");
-#endif
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
@@ -1933,9 +1921,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QVERIFY(!process.waitForReadyRead()); // used to crash
process.start("doesntexist");
QVERIFY(!process.waitForReadyRead());
-#if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX)
- QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Abort);
-#endif
QCOMPARE(errorSpy.count(), 1);
QCOMPARE(errorSpy.at(0).at(0).toInt(), 0);
QCOMPARE(errorSpy2.count(), 1);
@@ -2303,9 +2288,6 @@ void tst_QProcess::setNonExistentWorkingDirectory()
// while on Unix with fork it's relative to the child's (with posix_spawn, it could be either).
process.start(QFileInfo("testSetWorkingDirectory/testSetWorkingDirectory").absoluteFilePath());
QVERIFY(!process.waitForFinished());
-#ifdef QPROCESS_USE_SPAWN
- QEXPECT_FAIL("", "QProcess cannot detect failure to start when using posix_spawn()", Continue);
-#endif
QCOMPARE(int(process.error()), int(QProcess::FailedToStart));
#ifdef Q_OS_UNIX