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

Proposed by Gerry Boland on 2016-02-08
Status: Merged
Approved by: Pete Woods on 2016-02-08
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) 2016-02-08 Approve on 2016-02-08
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 on 2016-02-08

Add support for QDBUS_DBUS_START_TIMEOUT env var to customize timeout

Pete Woods (pete-woods) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/libqtdbustest/QProcessDBusService.cpp'
2--- src/libqtdbustest/QProcessDBusService.cpp 2013-11-13 10:13:18 +0000
3+++ src/libqtdbustest/QProcessDBusService.cpp 2016-02-08 17:27:20 +0000
4@@ -27,6 +27,21 @@
5
6 namespace QtDBusTest {
7
8+namespace {
9+ int timeoutInSeconds() {
10+ const int defaultTimeout = 15;
11+ QByteArray timeoutString = qgetenv("QDBUS_DBUS_START_TIMEOUT");
12+ if (!timeoutString.isEmpty()) {
13+ bool ok;
14+ const int timeout = timeoutString.toInt(&ok);
15+ if (ok) {
16+ return timeout;
17+ }
18+ }
19+ return defaultTimeout;
20+ }
21+} // anonymous namespace
22+
23 class QProcessDBusServicePrivate {
24 public:
25 QProcessDBusServicePrivate(const QString &program,
26@@ -70,7 +85,7 @@
27 throw std::logic_error(error.toStdString());
28 }
29 } else {
30- spy.wait();
31+ spy.wait(timeoutInSeconds() * 1000);
32 if (spy.empty()) {
33 QString error = "Process [" + p->m_program + "] for service ["
34 + name() + "] failed to appear on bus";

Subscribers

People subscribed via source and target branches

to all changes: