Skip to content

Commit

Permalink
Tests: Omit waiting for client process indefinitely
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Aug 20, 2017
1 parent 6e48f48 commit 649bffd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/tests/test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ const int waitMsSetClipboard = 1000;
/// Interval to wait (in ms) before getting clipboard.
const int waitMsGetClipboard = 100;

/// Interval to wait (in ms) for client process.
const int waitClientRun = 30000;

using Args = QStringList;

inline QByteArray toByteArray(const QString &text)
Expand Down
6 changes: 5 additions & 1 deletion src/tests/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ class TestInterfaceImpl : public TestInterface {
if (stderrData != nullptr)
stderrData->clear();

SleepTimer t(waitClientRun);
while ( p.state() == QProcess::Running ) {
const auto out = p.readAllStandardOutput();
const auto err = p.readAllStandardError();
Expand All @@ -271,7 +272,10 @@ class TestInterfaceImpl : public TestInterface {
if (stderrData != nullptr)
stderrData->append(err);

QCoreApplication::processEvents();
if ( !t.sleep() ) {
qWarning() << "client process timed out";
return -1;
}
}

if (stderrData != nullptr) {
Expand Down

0 comments on commit 649bffd

Please sign in to comment.