Merge lp:~thomas-voss/dbus-cpp/fix-1326200 into lp:dbus-cpp

Proposed by Thomas Voß
Status: Merged
Approved by: Pete Woods
Approved revision: 61
Merged at revision: 68
Proposed branch: lp:~thomas-voss/dbus-cpp/fix-1326200
Merge into: lp:dbus-cpp
Diff against target: 134 lines (+48/-2)
4 files modified
debian/libdbus-cpp4.symbols.32bit (+1/-0)
debian/libdbus-cpp4.symbols.64bit (+1/-0)
include/core/dbus/fixture.h (+8/-0)
src/core/dbus/fixture.cpp.in (+38/-2)
To merge this branch: bzr merge lp:~thomas-voss/dbus-cpp/fix-1326200
Reviewer Review Type Date Requested Status
Pete Woods (community) Approve
Manuel de la Peña (community) Approve
PS Jenkins bot continuous-integration Approve
James Henstridge Pending
Review via email: mp+224924@code.launchpad.net

Commit message

Make sure that dbus daemon instances fired up for testing are torn down after a configurable timeout.

Description of the change

Make sure that dbus daemon instances fired up for testing are torn down after a configurable timeout.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~thomas-voss/dbus-cpp/fix-1326200 updated
61. By Thomas Voß

Adjust symbol files to account for new timeout setup in core::dbus::Fixture.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Manuel de la Peña (mandel) wrote :

+1

review: Approve
Revision history for this message
Pete Woods (pete-woods) :
review: Approve
lp:~thomas-voss/dbus-cpp/fix-1326200 updated
62. By Thomas Voß

[ Thomas Voß ]
* Bump major revision and so name to account for toolchain update.
[ Thomas Voß ]
* Bumping revision to force build-dependency.
[ Manuel de la Pena ]
* Provide a new make_executor method to allow to pass the io_service.
[ Ubuntu daily release ]
* debian/*symbols: auto-update new symbols to released version
[ Ubuntu daily release ]
* New rebuild forced
[ Antti Kaijanmäki ]
* Fix read-only property PropertiesChanged updates. (LP: #1339589)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/libdbus-cpp4.symbols.32bit'
2--- debian/libdbus-cpp4.symbols.32bit 2014-07-18 09:34:18 +0000
3+++ debian/libdbus-cpp4.symbols.32bit 2014-07-30 15:57:58 +0000
4@@ -1,3 +1,4 @@
5+ (c++)"core::dbus::Fixture::default_daemon_timeout()@Base" 0replaceme
6 (c++)"core::dbus::asio::make_executor(std::shared_ptr<core::dbus::Bus> const&)@Base" 2.0.0+14.04.20140310
7 (c++)"core::dbus::asio::make_executor(std::shared_ptr<core::dbus::Bus> const&, boost::asio::io_service&)@Base" 3.1.0+14.10.20140711
8 (c++)"core::dbus::Bus::access_signal_router()@Base" 2.0.0+14.04.20140310
9
10=== modified file 'debian/libdbus-cpp4.symbols.64bit'
11--- debian/libdbus-cpp4.symbols.64bit 2014-07-18 09:34:18 +0000
12+++ debian/libdbus-cpp4.symbols.64bit 2014-07-30 15:57:58 +0000
13@@ -1,3 +1,4 @@
14+ (c++)"core::dbus::Fixture::default_daemon_timeout()@Base" 0replaceme
15 (c++)"core::dbus::asio::make_executor(std::shared_ptr<core::dbus::Bus> const&)@Base" 2.0.0+14.04.20140310
16 (c++)"core::dbus::asio::make_executor(std::shared_ptr<core::dbus::Bus> const&, boost::asio::io_service&)@Base" 3.1.0+14.10.20140711
17 (c++)"core::dbus::Bus::access_signal_router()@Base" 2.0.0+14.04.20140310
18
19=== modified file 'include/core/dbus/fixture.h'
20--- include/core/dbus/fixture.h 2014-01-10 07:34:59 +0000
21+++ include/core/dbus/fixture.h 2014-07-30 15:57:58 +0000
22@@ -20,6 +20,7 @@
23
24 #include <core/dbus/visibility.h>
25
26+#include <chrono>
27 #include <memory>
28 #include <string>
29
30@@ -35,6 +36,13 @@
31 class ORG_FREEDESKTOP_DBUS_DLL_PUBLIC Fixture
32 {
33 public:
34+ /** @brief Fractional seconds. */
35+ typedef std::chrono::duration<double> Seconds;
36+
37+ /**
38+ * @brief default_daemon_timeout after which the dbus daemons will be killed.
39+ */
40+ static Seconds& default_daemon_timeout();
41
42 /**
43 * @brief default_session_bus_config_file provides the filename of the default session
44
45=== modified file 'src/core/dbus/fixture.cpp.in'
46--- src/core/dbus/fixture.cpp.in 2014-01-23 11:51:23 +0000
47+++ src/core/dbus/fixture.cpp.in 2014-07-30 15:57:58 +0000
48@@ -31,6 +31,9 @@
49 {
50 std::vector<std::string> argv
51 {
52+ "--kill-after=5",
53+ std::to_string(core::dbus::Fixture::default_daemon_timeout().count()),
54+ "/bin/dbus-daemon",
55 "--config-file",
56 config_file,
57 "--print-address"
58@@ -43,7 +46,7 @@
59 });
60
61 daemon = core::posix::exec(
62- "/bin/dbus-daemon",
63+ "/usr/bin/timeout",
64 argv,
65 env,
66 core::posix::StandardStream::stdout);
67@@ -58,6 +61,18 @@
68 core::posix::this_process::env::set_or_throw("DBUS_STARTER_BUS_TYPE", "session");
69 }
70
71+ ~Session()
72+ {
73+ try
74+ {
75+ daemon.send_signal_or_throw(core::posix::Signal::sig_term);
76+ daemon.wait_for(core::posix::wait::Flags::untraced);
77+ } catch(...)
78+ {
79+ // We drop any exception to make the dtor exception safe.
80+ }
81+ }
82+
83 core::posix::ChildProcess daemon = core::posix::ChildProcess::invalid();
84 std::string address;
85 } session;
86@@ -68,6 +83,9 @@
87 {
88 std::vector<std::string> argv
89 {
90+ "--kill-after=5",
91+ std::to_string(core::dbus::Fixture::default_daemon_timeout().count()),
92+ "/bin/dbus-daemon",
93 "--config-file",
94 config_file,
95 "--print-address"
96@@ -80,7 +98,7 @@
97 });
98
99 daemon = core::posix::exec(
100- "/bin/dbus-daemon",
101+ "/usr/bin/timeout",
102 argv,
103 env,
104 core::posix::StandardStream::stdout);
105@@ -93,11 +111,29 @@
106 core::posix::this_process::env::set_or_throw("DBUS_SYSTEM_BUS_ADDRESS", address);
107 }
108
109+ ~System()
110+ {
111+ try
112+ {
113+ daemon.send_signal_or_throw(core::posix::Signal::sig_term);
114+ daemon.wait_for(core::posix::wait::Flags::untraced);
115+ } catch(...)
116+ {
117+ // We drop any exception to make the dtor exception safe.
118+ }
119+ }
120+
121 core::posix::ChildProcess daemon = core::posix::ChildProcess::invalid();
122 std::string address;
123 } system;
124 };
125
126+core::dbus::Fixture::Seconds& core::dbus::Fixture::default_daemon_timeout()
127+{
128+ static core::dbus::Fixture::Seconds instance{60};
129+ return instance;
130+}
131+
132 const std::string& core::dbus::Fixture::default_session_bus_config_file()
133 {
134 static const std::string s{"@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DATAROOTDIR@/dbus-cpp/session.conf"};

Subscribers

People subscribed via source and target branches