Merge lp:~gerboland/libqtdbustest/increase-wait-timeout into lp:libqtdbustest

Proposed by Gerry Boland
Status: Merged
Approved by: Pete Woods
Approved revision: 40
Merged at revision: 39
Proposed branch: lp:~gerboland/libqtdbustest/increase-wait-timeout
Merge into: lp:libqtdbustest
Diff against target: 34 lines (+16/-1)
1 file modified
src/libqtdbustest/QProcessDBusService.cpp (+16/-1)
To merge this branch: bzr merge lp:~gerboland/libqtdbustest/increase-wait-timeout
Reviewer Review Type Date Requested Status
Pete Woods (community) Approve
Review via email: mp+285376@code.launchpad.net

Commit message

Increase timeout when waiting for mock dbus service to appear on the bus.

May help test success on heavily loaded machines

To post a comment you must log in.
40. By Gerry Boland

Add support for QDBUS_DBUS_START_TIMEOUT env var to customize timeout

Revision history for this message
Pete Woods (pete-woods) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/libqtdbustest/QProcessDBusService.cpp'
--- src/libqtdbustest/QProcessDBusService.cpp 2013-11-13 10:13:18 +0000
+++ src/libqtdbustest/QProcessDBusService.cpp 2016-02-08 17:27:20 +0000
@@ -27,6 +27,21 @@
2727
28namespace QtDBusTest {28namespace QtDBusTest {
2929
30namespace {
31 int timeoutInSeconds() {
32 const int defaultTimeout = 15;
33 QByteArray timeoutString = qgetenv("QDBUS_DBUS_START_TIMEOUT");
34 if (!timeoutString.isEmpty()) {
35 bool ok;
36 const int timeout = timeoutString.toInt(&ok);
37 if (ok) {
38 return timeout;
39 }
40 }
41 return defaultTimeout;
42 }
43} // anonymous namespace
44
30class QProcessDBusServicePrivate {45class QProcessDBusServicePrivate {
31public:46public:
32 QProcessDBusServicePrivate(const QString &program,47 QProcessDBusServicePrivate(const QString &program,
@@ -70,7 +85,7 @@
70 throw std::logic_error(error.toStdString());85 throw std::logic_error(error.toStdString());
71 }86 }
72 } else {87 } else {
73 spy.wait();88 spy.wait(timeoutInSeconds() * 1000);
74 if (spy.empty()) {89 if (spy.empty()) {
75 QString error = "Process [" + p->m_program + "] for service ["90 QString error = "Process [" + p->m_program + "] for service ["
76 + name() + "] failed to appear on bus";91 + name() + "] failed to appear on bus";

Subscribers

People subscribed via source and target branches

to all changes: