From 1ff66a79626d40a8379a639a0fae3696fc7a06c0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 18 Feb 2015 12:36:47 -0800 Subject: QProcess: Ensure that the stdin buffer is cleared on start() The buffer may have been left dirty if we were unable to write all the data to the child process in the previous run. So ensure we clear it before starting a new one. We already did that for stdout and stderr, for some reason. Task-number: QTBUG-44517 Change-Id: I1a800c709d3543699131ffff13c419da3bbffacf Reviewed-by: Kai Koehne Reviewed-by: Joerg Bornemann Reviewed-by: Thiago Macieira Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 102 ++++++++++++++++++++++++ 1 file changed, 102 insertions(+) (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 99cb9ad6cb..7064b45d07 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1,6 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2015 Intel Corporation. ** Contact: http://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -150,6 +151,9 @@ private slots: void onlyOneStartedSignal(); void finishProcessBeforeReadingDone(); void waitForStartedWithoutStart(); + void startStopStartStop(); + void startStopStartStopBuffers_data(); + void startStopStartStopBuffers(); // keep these at the end, since they use lots of processes and sometimes // caused obscure failures to occur in tests that followed them (esp. on the Mac) @@ -2329,12 +2333,110 @@ void tst_QProcess::finishProcessBeforeReadingDone() QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number")); } +//----------------------------------------------------------------------------- void tst_QProcess::waitForStartedWithoutStart() { QProcess process; QVERIFY(!process.waitForStarted(5000)); } +//----------------------------------------------------------------------------- +void tst_QProcess::startStopStartStop() +{ + // we actually do start-stop x 3 :-) + QProcess process; + process.start("testProcessNormal/testProcessNormal"); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + + process.start("testExitCodes/testExitCodes", QStringList() << "1"); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 1); + + process.start("testProcessNormal/testProcessNormal"); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); +} + +//----------------------------------------------------------------------------- +void tst_QProcess::startStopStartStopBuffers_data() +{ + QTest::addColumn("channelMode1"); + QTest::addColumn("channelMode2"); + + QTest::newRow("separate-separate") << int(QProcess::SeparateChannels) << int(QProcess::SeparateChannels); + QTest::newRow("separate-merged") << int(QProcess::SeparateChannels) << int(QProcess::MergedChannels); + QTest::newRow("merged-separate") << int(QProcess::MergedChannels) << int(QProcess::SeparateChannels); + QTest::newRow("merged-merged") << int(QProcess::MergedChannels) << int(QProcess::MergedChannels); + QTest::newRow("merged-forwarded") << int(QProcess::MergedChannels) << int(QProcess::ForwardedChannels); +} + +void tst_QProcess::startStopStartStopBuffers() +{ + QFETCH(int, channelMode1); + QFETCH(int, channelMode2); + + QProcess process; + process.setProcessChannelMode(QProcess::ProcessChannelMode(channelMode1)); + process.start("testProcessHang/testProcessHang"); + QVERIFY2(process.waitForReadyRead(), process.errorString().toLocal8Bit()); + if (channelMode1 == QProcess::SeparateChannels || channelMode1 == QProcess::ForwardedOutputChannel) { + process.setReadChannel(QProcess::StandardError); + if (process.bytesAvailable() == 0) + QVERIFY(process.waitForReadyRead()); + process.setReadChannel(QProcess::StandardOutput); + } + + // We want to test that the write buffer still has bytes after the child + // exiting. We do that by writing to a child process that never reads. We + // just have to write more data than a pipe can hold, so that even if + // QProcess finds the pipe writable (during waitForFinished() or in the + // QWindowsPipeWriter thread), some data will remain. The worst case I know + // of is Linux, which defaults to 64 kB of buffer. + + process.write(QByteArray(128 * 1024, 'a')); + QVERIFY(process.bytesToWrite() > 0); + process.kill(); + + QVERIFY(process.waitForFinished()); + +#ifndef Q_OS_WIN + // confirm that our buffers are still full + // Note: this doesn't work on Windows because our buffers are drained into + // QWindowsPipeWriter before being sent to the child process. + QVERIFY(process.bytesToWrite() > 0); + QVERIFY(process.bytesAvailable() > 0); // channelMode1 is not ForwardedChannels + if (channelMode1 == QProcess::SeparateChannels || channelMode1 == QProcess::ForwardedOutputChannel) { + process.setReadChannel(QProcess::StandardError); + QVERIFY(process.bytesAvailable() > 0); + process.setReadChannel(QProcess::StandardOutput); + } +#endif + + process.setProcessChannelMode(QProcess::ProcessChannelMode(channelMode2)); + process.start("testProcessEcho2/testProcessEcho2", QIODevice::ReadWrite | QIODevice::Text); + + // the buffers should now be empty + QCOMPARE(process.bytesToWrite(), qint64(0)); + QCOMPARE(process.bytesAvailable(), qint64(0)); + process.setReadChannel(QProcess::StandardError); + QCOMPARE(process.bytesAvailable(), qint64(0)); + process.setReadChannel(QProcess::StandardOutput); + + process.write("line3\n"); + process.closeWriteChannel(); + QVERIFY(process.waitForFinished()); + QCOMPARE(process.exitCode(), 0); + + if (channelMode2 == QProcess::MergedChannels) { + QCOMPARE(process.readAll(), QByteArray("lliinnee33\n\n")); + } else if (channelMode2 != QProcess::ForwardedChannels) { + QCOMPARE(process.readAllStandardOutput(), QByteArray("line3\n")); + if (channelMode2 == QProcess::SeparateChannels) + QCOMPARE(process.readAllStandardError(), QByteArray("line3\n")); + } +} + #endif //QT_NO_PROCESS QTEST_MAIN(tst_QProcess) -- cgit v1.2.3 From 507625d984f9467b056e603560d62a2e4a56074d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 28 Jul 2015 13:43:54 +0200 Subject: fix assertion in QProcess/Win Do not call bytesAvailableInChannel if the source pipe end is invalid. This is the case when redirecting channels on Windows. The assertions in bytesAvailableInChannel were triggered whenever an output process or output file was set and waitForBytesWritten was called. Task-number: QTBUG-45548 Change-Id: I225dfea2c5e27e122f75008a3a06d425554e00fe Reviewed-by: Alex Trotsenko Reviewed-by: Oswald Buddenhagen --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 31 ++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 7064b45d07..11bdaec9c4 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -118,6 +118,7 @@ private slots: void setStandardOutputFile_data(); void setStandardOutputFile(); void setStandardOutputFile2(); + void setStandardOutputFileAndWaitForBytesWritten(); void setStandardOutputProcess_data(); void setStandardOutputProcess(); void removeFileWhileProcessIsRunning(); @@ -2068,6 +2069,26 @@ void tst_QProcess::setStandardOutputFile() QCOMPARE(all.size(), expectedsize); } + +void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() +{ + static const char testdata[] = "Test data."; + + QFile file("data"); + QProcess process; + process.setStandardOutputFile(file.fileName()); + process.start("testProcessEcho2/testProcessEcho2"); + process.write(testdata, sizeof testdata); + process.waitForBytesWritten(); + QPROCESS_VERIFY(process, waitForFinished()); + + // open the file again and verify the data + QVERIFY(file.open(QIODevice::ReadOnly)); + QByteArray all = file.readAll(); + file.close(); + + QCOMPARE(all, QByteArray::fromRawData(testdata, sizeof testdata - 1)); +} #endif //----------------------------------------------------------------------------- @@ -2076,17 +2097,19 @@ void tst_QProcess::setStandardOutputFile() void tst_QProcess::setStandardOutputProcess_data() { QTest::addColumn("merged"); - QTest::newRow("separate") << false; - QTest::newRow("merged") << true; + QTest::addColumn("waitForBytesWritten"); + QTest::newRow("separate") << false << false; + QTest::newRow("separate with waitForBytesWritten") << false << true; + QTest::newRow("merged") << true << false; } void tst_QProcess::setStandardOutputProcess() { - QProcess source; QProcess sink; QFETCH(bool, merged); + QFETCH(bool, waitForBytesWritten); source.setReadChannelMode(merged ? QProcess::MergedChannels : QProcess::SeparateChannels); source.setStandardOutputProcess(&sink); @@ -2095,6 +2118,8 @@ void tst_QProcess::setStandardOutputProcess() QByteArray data("Hello, World"); source.write(data); + if (waitForBytesWritten) + source.waitForBytesWritten(); source.closeWriteChannel(); QPROCESS_VERIFY(source, waitForFinished()); QPROCESS_VERIFY(sink, waitForFinished()); -- cgit v1.2.3 From 734557bb8491c92f918718ea8448ec2ee6b0a328 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 28 Jul 2015 14:40:02 +0200 Subject: tst_qprocess cleanup Give setStandardOutputFile2 a sensible name, move it to where it belongs and remove bogus Q_OS_WINCE ifdef. Change-Id: I5c843e8b6cb626979966f3e61f7a7c720173bb28 Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 32 ++++++++++++------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index 11bdaec9c4..0995f764b7 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -117,7 +117,7 @@ private slots: void setStandardInputFile(); void setStandardOutputFile_data(); void setStandardOutputFile(); - void setStandardOutputFile2(); + void setStandardOutputFileNullDevice(); void setStandardOutputFileAndWaitForBytesWritten(); void setStandardOutputProcess_data(); void setStandardOutputProcess(); @@ -2005,22 +2005,6 @@ void tst_QProcess::setStandardOutputFile_data() } //----------------------------------------------------------------------------- -#ifndef Q_OS_WINCE -void tst_QProcess::setStandardOutputFile2() -{ - static const char testdata[] = "Test data."; - - QProcess process; - process.setStandardOutputFile(QProcess::nullDevice()); - process.start("testProcessEcho2/testProcessEcho2"); - process.write(testdata, sizeof testdata); - QPROCESS_VERIFY(process,waitForFinished()); - QCOMPARE(process.bytesAvailable(), Q_INT64_C(0)); - - QVERIFY(!QFileInfo(QProcess::nullDevice()).isFile()); -} -#endif - void tst_QProcess::setStandardOutputFile() { static const char data[] = "Original data. "; @@ -2070,6 +2054,20 @@ void tst_QProcess::setStandardOutputFile() QCOMPARE(all.size(), expectedsize); } +void tst_QProcess::setStandardOutputFileNullDevice() +{ + static const char testdata[] = "Test data."; + + QProcess process; + process.setStandardOutputFile(QProcess::nullDevice()); + process.start("testProcessEcho2/testProcessEcho2"); + process.write(testdata, sizeof testdata); + QPROCESS_VERIFY(process,waitForFinished()); + QCOMPARE(process.bytesAvailable(), Q_INT64_C(0)); + + QVERIFY(!QFileInfo(QProcess::nullDevice()).isFile()); +} + void tst_QProcess::setStandardOutputFileAndWaitForBytesWritten() { static const char testdata[] = "Test data."; -- cgit v1.2.3 From a4bd096a0a7bfe676bf9c541bc33894eb7dd19b1 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 24 Aug 2015 15:25:57 +0200 Subject: remove pointless function separator comments from tst_qprocess Newer test functions don't have those. Removing those comments makes the code consistent. Change-Id: I542b89e797ef061395ce1fc87d848195e6f81f35 Reviewed-by: Friedemann Kleint --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 70 ++----------------------- 1 file changed, 3 insertions(+), 67 deletions(-) (limited to 'tests/auto/corelib/io/qprocess/tst_qprocess.cpp') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e810f48d6c..0d4c53a7a9 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -215,7 +215,6 @@ void tst_QProcess::getSetCheck() QCOMPARE(QProcess::ProcessChannel(QProcess::StandardError), obj1.readChannel()); } -//----------------------------------------------------------------------------- void tst_QProcess::constructing() { QProcess process; @@ -277,7 +276,6 @@ void tst_QProcess::simpleStart() QCOMPARE(qvariant_cast(spy.at(2).at(0)), QProcess::NotRunning); } -//----------------------------------------------------------------------------- void tst_QProcess::startWithOpen() { QProcess p; @@ -295,7 +293,6 @@ void tst_QProcess::startWithOpen() QVERIFY(p.waitForFinished(5000)); } -//----------------------------------------------------------------------------- void tst_QProcess::startWithOldOpen() { // similar to the above, but we start with start() actually @@ -314,7 +311,6 @@ void tst_QProcess::startWithOldOpen() QVERIFY(p.waitForFinished(5000)); } -//----------------------------------------------------------------------------- void tst_QProcess::execute() { QCOMPARE(QProcess::execute("testProcessNormal/testProcessNormal", @@ -322,7 +318,6 @@ void tst_QProcess::execute() QCOMPARE(QProcess::execute("nonexistingexe"), -2); } -//----------------------------------------------------------------------------- void tst_QProcess::startDetached() { QProcess proc; @@ -334,7 +329,6 @@ void tst_QProcess::startDetached() QCOMPARE(QProcess::startDetached("nonexistingexe"), false); } -//----------------------------------------------------------------------------- void tst_QProcess::readFromProcess() { int lines = 0; @@ -344,7 +338,6 @@ void tst_QProcess::readFromProcess() } } -//----------------------------------------------------------------------------- void tst_QProcess::crashTest() { qRegisterMetaType("QProcess::ProcessState"); @@ -387,7 +380,6 @@ void tst_QProcess::crashTest() QCOMPARE(qvariant_cast(stateSpy.at(2).at(0)), QProcess::NotRunning); } -//----------------------------------------------------------------------------- void tst_QProcess::crashTest2() { process = new QProcess; @@ -423,7 +415,6 @@ void tst_QProcess::crashTest2() #ifndef Q_OS_WINCE //Reading and writing to a process is not supported on Qt/CE -//----------------------------------------------------------------------------- void tst_QProcess::echoTest_data() { QTest::addColumn("input"); @@ -438,8 +429,6 @@ void tst_QProcess::echoTest_data() QTest::newRow("10000 bytes") << QByteArray(10000, '@'); } -//----------------------------------------------------------------------------- - void tst_QProcess::echoTest() { QFETCH(QByteArray, input); @@ -484,14 +473,11 @@ void tst_QProcess::echoTest() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::exitLoopSlot() { QTestEventLoop::instance().exitLoop(); } -//----------------------------------------------------------------------------- - #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::echoTest2() @@ -543,7 +529,6 @@ void tst_QProcess::echoTest2() #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Reading and writing to a process is not supported on Qt/CE -//----------------------------------------------------------------------------- void tst_QProcess::echoTestGui() { QProcess process; @@ -572,7 +557,6 @@ void tst_QProcess::testSetNamedPipeHandleState() } #endif // !Q_OS_WINCE && Q_OS_WIN -//----------------------------------------------------------------------------- #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) // Batch files are not supported on Windows CE void tst_QProcess::batFiles_data() @@ -601,7 +585,6 @@ void tst_QProcess::batFiles() } #endif // !Q_OS_WINCE && Q_OS_WIN -//----------------------------------------------------------------------------- void tst_QProcess::exitStatus_data() { QTest::addColumn("processList"); @@ -644,7 +627,7 @@ void tst_QProcess::exitStatus() process->deleteLater(); process = 0; } -//----------------------------------------------------------------------------- + #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::loopBackTest() @@ -670,7 +653,6 @@ void tst_QProcess::loopBackTest() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::readTimeoutAndThenCrash() @@ -754,7 +736,6 @@ void tst_QProcess::deadWhileReading() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::restartProcessDeadlock() @@ -784,7 +765,6 @@ void tst_QProcess::restartProcess() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::closeWriteChannel() @@ -812,7 +792,6 @@ void tst_QProcess::closeWriteChannel() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE" void tst_QProcess::closeReadChannel() @@ -844,7 +823,6 @@ void tst_QProcess::closeReadChannel() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::openModes() @@ -889,7 +867,6 @@ void tst_QProcess::openModes() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() @@ -925,7 +902,6 @@ void tst_QProcess::emitReadyReadOnlyWhenNewDataArrives() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::hardExit() { QProcess proc; @@ -949,7 +925,6 @@ void tst_QProcess::hardExit() QCOMPARE(int(proc.error()), int(QProcess::Crashed)); } -//----------------------------------------------------------------------------- void tst_QProcess::softExit() { QProcess proc; @@ -1059,7 +1034,6 @@ private: QByteArray dataToWrite; }; -//----------------------------------------------------------------------------- void tst_QProcess::softExitInSlots_data() { QTest::addColumn("appName"); @@ -1069,7 +1043,6 @@ void tst_QProcess::softExitInSlots_data() #endif QTest::newRow("console app") << "testProcessEcho2/testProcessEcho2"; } -//----------------------------------------------------------------------------- void tst_QProcess::softExitInSlots() { @@ -1085,7 +1058,6 @@ void tst_QProcess::softExitInSlots() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::mergedChannels() @@ -1110,7 +1082,6 @@ void tst_QProcess::mergedChannels() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE @@ -1165,7 +1136,6 @@ void tst_QProcess::forwardedChannels() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd() @@ -1226,7 +1196,6 @@ private: int exitCode; }; -//----------------------------------------------------------------------------- void tst_QProcess::processInAThread() { for (int i = 0; i < 10; ++i) { @@ -1237,7 +1206,6 @@ void tst_QProcess::processInAThread() } } -//----------------------------------------------------------------------------- void tst_QProcess::processesInMultipleThreads() { for (int i = 0; i < 10; ++i) { @@ -1262,7 +1230,6 @@ void tst_QProcess::processesInMultipleThreads() } } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForFinishedWithTimeout() @@ -1283,7 +1250,6 @@ void tst_QProcess::waitForFinishedWithTimeout() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlot() @@ -1312,7 +1278,6 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlot() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() @@ -1324,7 +1289,6 @@ void tst_QProcess::waitForReadyReadInAReadyReadSlotSlot() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() @@ -1351,7 +1315,6 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlot() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() @@ -1361,7 +1324,7 @@ void tst_QProcess::waitForBytesWrittenInABytesWrittenSlotSlot() QTestEventLoop::instance().exitLoop(); } #endif -//----------------------------------------------------------------------------- + void tst_QProcess::spaceArgsTest_data() { QTest::addColumn("args"); @@ -1414,7 +1377,6 @@ static QByteArray startFailMessage(const QString &program, const QProcess &proce return result; } -//----------------------------------------------------------------------------- void tst_QProcess::spaceArgsTest() { QFETCH(QStringList, args); @@ -1487,7 +1449,6 @@ void tst_QProcess::spaceArgsTest() #if defined(Q_OS_WIN) -//----------------------------------------------------------------------------- void tst_QProcess::nativeArguments() { QProcess proc; @@ -1531,7 +1492,6 @@ void tst_QProcess::nativeArguments() #endif -//----------------------------------------------------------------------------- void tst_QProcess::exitCodeTest() { for (int i = 0; i < 255; ++i) { @@ -1548,7 +1508,6 @@ void tst_QProcess::exitCodeTest() } } -//----------------------------------------------------------------------------- void tst_QProcess::failToStart() { #if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) @@ -1622,7 +1581,6 @@ void tst_QProcess::failToStart() } } -//----------------------------------------------------------------------------- void tst_QProcess::failToStartWithWait() { #if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) @@ -1655,7 +1613,6 @@ void tst_QProcess::failToStartWithWait() } } -//----------------------------------------------------------------------------- void tst_QProcess::failToStartWithEventLoop() { #if defined(QPROCESS_USE_SPAWN) && !defined(Q_OS_QNX) @@ -1729,7 +1686,6 @@ void tst_QProcess::failToStartEmptyArgs() QCOMPARE(process.error(), QProcess::FailedToStart); } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::removeFileWhileProcessIsRunning() @@ -1748,7 +1704,6 @@ void tst_QProcess::removeFileWhileProcessIsRunning() QVERIFY(process.waitForFinished(5000)); } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // OS doesn't support environment variables void tst_QProcess::setEnvironment_data() @@ -1826,7 +1781,6 @@ void tst_QProcess::setEnvironment() } } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // OS doesn't support environment variables void tst_QProcess::setProcessEnvironment_data() @@ -1867,7 +1821,7 @@ void tst_QProcess::setProcessEnvironment() } } #endif -//----------------------------------------------------------------------------- + void tst_QProcess::systemEnvironment() { #if defined (Q_OS_WINCE) @@ -1883,7 +1837,6 @@ void tst_QProcess::systemEnvironment() #endif } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::spaceInName() @@ -1896,7 +1849,6 @@ void tst_QProcess::spaceInName() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::lockupsInStartDetached() { // Check that QProcess doesn't cause a lock up at this program's @@ -1910,7 +1862,6 @@ void tst_QProcess::lockupsInStartDetached() QProcess::startDetached("yjhbrty"); } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::atEnd2() @@ -1929,7 +1880,6 @@ void tst_QProcess::atEnd2() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::waitForReadyReadForNonexistantProcess() { // Start a program that doesn't exist, process events and then try to waitForReadyRead @@ -1961,7 +1911,6 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess() QCOMPARE(finishedSpy2.count(), 0); } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardInputFile() @@ -1991,7 +1940,6 @@ void tst_QProcess::setStandardInputFile() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputFile_data() @@ -2022,7 +1970,6 @@ void tst_QProcess::setStandardOutputFile_data() << true; } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE void tst_QProcess::setStandardOutputFile2() { @@ -2089,7 +2036,6 @@ void tst_QProcess::setStandardOutputFile() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::setStandardOutputProcess_data() @@ -2126,7 +2072,6 @@ void tst_QProcess::setStandardOutputProcess() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::fileWriterProcess() @@ -2154,7 +2099,6 @@ void tst_QProcess::fileWriterProcess() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::detachedWorkingDirectoryAndPid() { qint64 pid; @@ -2198,7 +2142,6 @@ void tst_QProcess::detachedWorkingDirectoryAndPid() QCOMPARE(actualPid, pid); } -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Reading and writing to a process is not supported on Qt/CE void tst_QProcess::switchReadChannels() @@ -2248,7 +2191,6 @@ void tst_QProcess::discardUnwantedOutput() } #endif -//----------------------------------------------------------------------------- #ifndef Q_OS_WINCE // Q_OS_WIN - setWorkingDirectory will chdir before starting the process on unices // Windows CE does not support working directory logic @@ -2270,7 +2212,6 @@ void tst_QProcess::setWorkingDirectory() process = 0; } -//----------------------------------------------------------------------------- void tst_QProcess::setNonExistentWorkingDirectory() { process = new QProcess; @@ -2290,7 +2231,6 @@ void tst_QProcess::setNonExistentWorkingDirectory() } #endif -//----------------------------------------------------------------------------- void tst_QProcess::startFinishStartFinish() { QProcess process; @@ -2309,7 +2249,6 @@ void tst_QProcess::startFinishStartFinish() } } -//----------------------------------------------------------------------------- void tst_QProcess::invalidProgramString_data() { QTest::addColumn("programString"); @@ -2337,7 +2276,6 @@ void tst_QProcess::invalidProgramString() QVERIFY(!QProcess::startDetached(programString)); } -//----------------------------------------------------------------------------- void tst_QProcess::onlyOneStartedSignal() { qRegisterMetaType("QProcess::ExitStatus"); @@ -2364,8 +2302,6 @@ void tst_QProcess::onlyOneStartedSignal() QCOMPARE(spyFinished.count(), 1); } -//----------------------------------------------------------------------------- - class BlockOnReadStdOut : public QObject { Q_OBJECT -- cgit v1.2.3