diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-09-03 21:52:22 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-05 21:17:39 +0200 |
commit | fba0a307914772b286e8f315e0d1dec5ce7935f8 (patch) | |
tree | 10908de0f4da40445ff5db2072a7e7ccc532a0ef /tests/auto/corelib/io/qprocess/testForwarding | |
parent | dd9d6b3d5b21281707440db4413707e1d818889e (diff) |
add QProcess::Forwarded{Output,Error}Channel
Change-Id: Ifc5ed20c38f3228ef25c28681f296d0456b61abe
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests/auto/corelib/io/qprocess/testForwarding')
-rw-r--r-- | tests/auto/corelib/io/qprocess/testForwarding/main.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp index 3122232ee1..deff2b95ad 100644 --- a/tests/auto/corelib/io/qprocess/testForwarding/main.cpp +++ b/tests/auto/corelib/io/qprocess/testForwarding/main.cpp @@ -42,30 +42,41 @@ #include <QtCore/QCoreApplication> #include <QtCore/QProcess> +#include <stdlib.h> + int main(int argc, char **argv) { QCoreApplication app(argc, argv); + if (argc < 2) + return 13; + #ifndef QT_NO_PROCESS QProcess process; - process.setProcessChannelMode(QProcess::ForwardedChannels); - if (process.processChannelMode() != QProcess::ForwardedChannels) + + QProcess::ProcessChannelMode mode = (QProcess::ProcessChannelMode)atoi(argv[1]); + process.setProcessChannelMode(mode); + if (process.processChannelMode() != mode) return 1; - process.start("testProcessEcho/testProcessEcho"); + process.start("testProcessEcho2/testProcessEcho2"); if (!process.waitForStarted(5000)) return 2; - if (process.write("forwarded\n") != 10) + if (process.write("forwarded") != 9) return 3; process.closeWriteChannel(); if (!process.waitForFinished(5000)) return 4; - if (process.bytesAvailable() != 0) + if ((mode == QProcess::ForwardedOutputChannel || mode == QProcess::ForwardedChannels) + && !process.readAllStandardOutput().isEmpty()) return 5; + if ((mode == QProcess::ForwardedErrorChannel || mode == QProcess::ForwardedChannels) + && !process.readAllStandardError().isEmpty()) + return 6; #endif return 0; } |