diff options
author | Liang Qi <liang.qi@qt.io> | 2016-08-16 07:58:32 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-16 07:58:32 +0200 |
commit | 17198e03ab36e5f579a1477b09cc3e601975eb5f (patch) | |
tree | 61ba826e9edd53469abdc1e1f58b1223d0336c56 /tests/auto/corelib/io/qprocess/tst_qprocess.cpp | |
parent | a5e89005445ac8ca18ac046eaf55fe2230e47cd6 (diff) | |
parent | 2e2b32a9ab459f6618d02e4b454c75a787172def (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
qmake/doc/src/qmake-manual.qdoc
src/corelib/global/qglobal.cpp
src/corelib/tools/qstring.cpp
src/network/socket/qabstractsocket.cpp
src/network/socket/qnativesocketengine_unix.cpp
src/plugins/platforms/eglfs/api/qeglfsglobal.h
Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
Diffstat (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp')
-rw-r--r-- | tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 0bc1e77925..3f3533c9a1 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -734,6 +734,7 @@ void tst_QProcess::restartProcess() void tst_QProcess::closeWriteChannel() { + QByteArray testData("Data to read"); QProcess more; more.start("testProcessEOF/testProcessEOF"); @@ -741,19 +742,21 @@ void tst_QProcess::closeWriteChannel() QVERIFY(!more.waitForReadyRead(250)); QCOMPARE(more.error(), QProcess::Timedout); - QVERIFY(more.write("Data to read") != -1); + QCOMPARE(more.write(testData), qint64(testData.size())); QVERIFY(!more.waitForReadyRead(250)); QCOMPARE(more.error(), QProcess::Timedout); more.closeWriteChannel(); - - QVERIFY(more.waitForReadyRead(5000)); - QVERIFY(more.readAll().startsWith("Data to read")); + // During closeWriteChannel() call, we might also get an I/O completion + // on the read pipe. So, take this into account before waiting for + // the new incoming data. + while (more.bytesAvailable() < testData.size()) + QVERIFY(more.waitForReadyRead(5000)); + QCOMPARE(more.readAll(), testData); if (more.state() == QProcess::Running) - more.write("q"); - QVERIFY(more.waitForFinished(5000)); + QVERIFY(more.waitForFinished(5000)); QCOMPARE(more.exitStatus(), QProcess::NormalExit); QCOMPARE(more.exitCode(), 0); } |