Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2016 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Brad Bishop | e30dd77 | 2016-11-12 21:39:28 -0500 | [diff] [blame] | 16 | #include "../manager.hpp" |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 17 | #include "../config.h" |
| 18 | #include <cassert> |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 19 | #include <iostream> |
| 20 | #include <algorithm> |
Brad Bishop | 2162143 | 2017-01-13 16:35:53 -0500 | [diff] [blame] | 21 | #include <thread> |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 22 | #include <chrono> |
| 23 | #include <xyz/openbmc_project/Example/Iface1/server.hpp> |
| 24 | #include <xyz/openbmc_project/Example/Iface2/server.hpp> |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 25 | |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 26 | using namespace std::literals::chrono_literals; |
| 27 | using namespace std::literals::string_literals; |
| 28 | |
| 29 | constexpr auto MGR_SERVICE = "phosphor.inventory.test.mgr"; |
| 30 | constexpr auto MGR_INTERFACE = IFACE; |
| 31 | constexpr auto MGR_ROOT = "/testing/inventory"; |
| 32 | constexpr auto EXAMPLE_SERVICE = "phosphor.inventory.test.example"; |
| 33 | constexpr auto EXAMPLE_ROOT = "/testing"; |
| 34 | |
| 35 | const auto trigger1 = sdbusplus::message::object_path(EXAMPLE_ROOT + |
| 36 | "/trigger1"s); |
| 37 | const auto trigger2 = sdbusplus::message::object_path(EXAMPLE_ROOT + |
| 38 | "/trigger2"s); |
| 39 | |
| 40 | using ExampleIface1 = sdbusplus::xyz::openbmc_project::Example::server::Iface1; |
| 41 | using ExampleIface2 = sdbusplus::xyz::openbmc_project::Example::server::Iface2; |
| 42 | |
| 43 | /** @class ExampleService |
| 44 | * @brief Host an object for triggering events. |
| 45 | */ |
| 46 | struct ExampleService |
| 47 | { |
| 48 | ~ExampleService() = default; |
| 49 | ExampleService() : |
| 50 | shutdown(false), |
| 51 | bus(sdbusplus::bus::new_default()), |
| 52 | objmgr(sdbusplus::server::manager::manager(bus, MGR_ROOT)) |
| 53 | { |
| 54 | bus.request_name(EXAMPLE_SERVICE); |
| 55 | } |
| 56 | |
| 57 | void run() |
| 58 | { |
| 59 | sdbusplus::server::object::object < |
| 60 | ExampleIface1, ExampleIface2 > t1(bus, trigger1.str.c_str()); |
| 61 | sdbusplus::server::object::object < |
| 62 | ExampleIface1, ExampleIface2 > t2(bus, trigger2.str.c_str()); |
| 63 | |
| 64 | while (!shutdown) |
| 65 | { |
| 66 | bus.process_discard(); |
| 67 | bus.wait((5000000us).count()); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | volatile bool shutdown; |
| 72 | sdbusplus::bus::bus bus; |
| 73 | sdbusplus::server::manager::manager objmgr; |
| 74 | }; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 75 | |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 76 | /** @class SignalQueue |
| 77 | * @brief Store DBus signals in a queue. |
| 78 | */ |
| 79 | class SignalQueue |
| 80 | { |
| 81 | public: |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 82 | ~SignalQueue() = default; |
| 83 | SignalQueue() = delete; |
| 84 | SignalQueue(const SignalQueue&) = delete; |
| 85 | SignalQueue(SignalQueue&&) = default; |
| 86 | SignalQueue& operator=(const SignalQueue&) = delete; |
| 87 | SignalQueue& operator=(SignalQueue&&) = default; |
| 88 | explicit SignalQueue(const std::string& match) : |
| 89 | _bus(sdbusplus::bus::new_default()), |
| 90 | _match(_bus, match.c_str(), &callback, this), |
| 91 | _next(nullptr) |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 92 | { |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 93 | } |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 94 | |
| 95 | auto&& pop(unsigned timeout = 1000000) |
| 96 | { |
| 97 | while (timeout > 0 && !_next) |
| 98 | { |
| 99 | _bus.process_discard(); |
| 100 | _bus.wait(50000); |
| 101 | timeout -= 50000; |
| 102 | } |
| 103 | return std::move(_next); |
| 104 | } |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 105 | |
| 106 | private: |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 107 | static int callback(sd_bus_message* m, void* context, sd_bus_error*) |
| 108 | { |
| 109 | auto* me = static_cast<SignalQueue*>(context); |
| 110 | sd_bus_message_ref(m); |
| 111 | sdbusplus::message::message msg{m}; |
| 112 | me->_next = std::move(msg); |
| 113 | return 0; |
| 114 | } |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 115 | |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 116 | sdbusplus::bus::bus _bus; |
| 117 | sdbusplus::server::match::match _match; |
| 118 | sdbusplus::message::message _next; |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 119 | }; |
| 120 | |
| 121 | template <typename ...T> |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 122 | using Object = std::map < |
| 123 | std::string, |
| 124 | std::map < |
| 125 | std::string, |
| 126 | sdbusplus::message::variant<T... >>>; |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 127 | |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 128 | /**@brief Find a subset of interfaces and properties in an object. */ |
| 129 | template <typename ...T> |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 130 | auto hasProperties(const Object<T...>& l, const Object<T...>& r) |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 131 | { |
| 132 | Object<T...> result; |
| 133 | std::set_difference( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 134 | r.cbegin(), |
| 135 | r.cend(), |
| 136 | l.cbegin(), |
| 137 | l.cend(), |
| 138 | std::inserter(result, result.end())); |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 139 | return result.empty(); |
| 140 | } |
| 141 | |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 142 | /**@brief Check an object for one or more interfaces. */ |
| 143 | template <typename ...T> |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 144 | auto hasInterfaces(const std::vector<std::string>& l, const Object<T...>& r) |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 145 | { |
| 146 | std::vector<std::string> stripped, interfaces; |
| 147 | std::transform( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 148 | r.cbegin(), |
| 149 | r.cend(), |
| 150 | std::back_inserter(stripped), |
| 151 | [](auto & p) |
| 152 | { |
| 153 | return p.first; |
| 154 | }); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 155 | std::set_difference( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 156 | stripped.cbegin(), |
| 157 | stripped.cend(), |
| 158 | l.cbegin(), |
| 159 | l.cend(), |
| 160 | std::back_inserter(interfaces)); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 161 | return interfaces.empty(); |
| 162 | } |
| 163 | |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 164 | void runTests() |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 165 | { |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 166 | const std::string root{MGR_ROOT}; |
| 167 | const std::string exampleRoot{EXAMPLE_ROOT}; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 168 | auto b = sdbusplus::bus::new_default(); |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 169 | |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 170 | auto notify = [&]() |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 171 | { |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 172 | return b.new_method_call( |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 173 | MGR_SERVICE, |
| 174 | MGR_ROOT, |
| 175 | MGR_INTERFACE, |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 176 | "Notify"); |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 177 | }; |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 178 | auto set = [&](const std::string & path) |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 179 | { |
| 180 | return b.new_method_call( |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 181 | EXAMPLE_SERVICE, |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 182 | path.c_str(), |
| 183 | "org.freedesktop.DBus.Properties", |
| 184 | "Set"); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 185 | }; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 186 | |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 187 | Object<std::string> obj |
| 188 | { |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 189 | { |
| 190 | "xyz.openbmc_project.Example.Iface1", |
| 191 | {{"ExampleProperty1", "test1"}} |
| 192 | }, |
| 193 | { |
| 194 | "xyz.openbmc_project.Example.Iface2", |
| 195 | {{"ExampleProperty2", "test2"}} |
| 196 | }, |
| 197 | }; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 198 | |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 199 | // Make sure the notify method works. |
| 200 | { |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 201 | sdbusplus::message::object_path relPath{"/foo"}; |
| 202 | std::string path(root + relPath.str); |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 203 | |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 204 | SignalQueue queue( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 205 | "path='" + root + "',member='InterfacesAdded'"); |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 206 | |
| 207 | auto m = notify(); |
| 208 | m.append(relPath); |
| 209 | m.append(obj); |
| 210 | b.call(m); |
| 211 | |
| 212 | auto sig{queue.pop()}; |
| 213 | assert(sig); |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 214 | sdbusplus::message::object_path signalPath; |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 215 | Object<std::string> signalObject; |
| 216 | sig.read(signalPath); |
Brad Bishop | e07a164 | 2017-01-24 14:37:33 -0500 | [diff] [blame] | 217 | assert(path == signalPath.str); |
Brad Bishop | abb2a1a | 2016-11-30 22:02:28 -0500 | [diff] [blame] | 218 | sig.read(signalObject); |
| 219 | assert(hasProperties(signalObject, obj)); |
| 220 | auto moreSignals{queue.pop()}; |
| 221 | assert(!moreSignals); |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 222 | } |
| 223 | |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 224 | // Make sure DBus signals are handled. |
| 225 | { |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 226 | sdbusplus::message::object_path relDeleteMeOne{"/deleteme1"}; |
| 227 | sdbusplus::message::object_path relDeleteMeTwo{"/deleteme2"}; |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 228 | std::string deleteMeOne{root + relDeleteMeOne.str}; |
| 229 | std::string deleteMeTwo{root + relDeleteMeTwo.str}; |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 230 | |
| 231 | // Create some objects to be deleted by an action. |
| 232 | { |
| 233 | auto m = notify(); |
| 234 | m.append(relDeleteMeOne); |
| 235 | m.append(obj); |
| 236 | b.call(m); |
| 237 | } |
| 238 | { |
| 239 | auto m = notify(); |
| 240 | m.append(relDeleteMeTwo); |
| 241 | m.append(obj); |
| 242 | b.call(m); |
| 243 | } |
| 244 | |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 245 | // Set a property that should not trigger due to a filter. |
| 246 | { |
| 247 | SignalQueue queue( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 248 | "path='" + root + "',member='InterfacesRemoved'"); |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 249 | auto m = set(trigger1.str); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 250 | m.append("xyz.openbmc_project.Example.Iface2"); |
| 251 | m.append("ExampleProperty2"); |
| 252 | m.append(sdbusplus::message::variant<std::string>("abc123")); |
| 253 | b.call(m); |
| 254 | auto sig{queue.pop()}; |
| 255 | assert(!sig); |
| 256 | } |
| 257 | |
| 258 | // Set a property that should trigger. |
| 259 | { |
| 260 | SignalQueue queue( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 261 | "path='" + root + "',member='InterfacesRemoved'"); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 262 | |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 263 | auto m = set(trigger1.str); |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 264 | m.append("xyz.openbmc_project.Example.Iface2"); |
| 265 | m.append("ExampleProperty2"); |
| 266 | m.append(sdbusplus::message::variant<std::string>("xxxyyy")); |
| 267 | b.call(m); |
| 268 | |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 269 | sdbusplus::message::object_path sigpath; |
Brad Bishop | 432e352 | 2016-12-01 00:24:14 -0500 | [diff] [blame] | 270 | std::vector<std::string> interfaces; |
| 271 | { |
| 272 | std::vector<std::string> interfaces; |
| 273 | auto sig{queue.pop()}; |
| 274 | assert(sig); |
| 275 | sig.read(sigpath); |
| 276 | assert(sigpath == deleteMeOne); |
| 277 | sig.read(interfaces); |
| 278 | std::sort(interfaces.begin(), interfaces.end()); |
| 279 | assert(hasInterfaces(interfaces, obj)); |
| 280 | } |
| 281 | { |
| 282 | std::vector<std::string> interfaces; |
| 283 | auto sig{queue.pop()}; |
| 284 | assert(sig); |
| 285 | sig.read(sigpath); |
| 286 | assert(sigpath == deleteMeTwo); |
| 287 | sig.read(interfaces); |
| 288 | std::sort(interfaces.begin(), interfaces.end()); |
| 289 | assert(hasInterfaces(interfaces, obj)); |
| 290 | } |
| 291 | { |
| 292 | // Make sure there were only two signals. |
| 293 | auto sig{queue.pop()}; |
| 294 | assert(!sig); |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | |
Brad Bishop | 22ecacc | 2016-12-01 08:38:06 -0500 | [diff] [blame] | 299 | // Validate the set property action. |
| 300 | { |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 301 | sdbusplus::message::object_path relChangeMe{"/changeme"}; |
Brad Bishop | 9aa5e2f | 2017-01-15 19:45:40 -0500 | [diff] [blame] | 302 | std::string changeMe{root + relChangeMe.str}; |
Brad Bishop | 22ecacc | 2016-12-01 08:38:06 -0500 | [diff] [blame] | 303 | |
| 304 | // Create an object to be updated by the set property action. |
| 305 | { |
| 306 | auto m = notify(); |
| 307 | m.append(relChangeMe); |
| 308 | m.append(obj); |
| 309 | b.call(m); |
| 310 | } |
| 311 | |
Brad Bishop | 22ecacc | 2016-12-01 08:38:06 -0500 | [diff] [blame] | 312 | // Trigger and validate the change. |
| 313 | { |
| 314 | SignalQueue queue( |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 315 | "path='" + changeMe + "',member='PropertiesChanged'"); |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 316 | auto m = set(trigger2.str); |
Brad Bishop | 22ecacc | 2016-12-01 08:38:06 -0500 | [diff] [blame] | 317 | m.append("xyz.openbmc_project.Example.Iface2"); |
| 318 | m.append("ExampleProperty2"); |
| 319 | m.append(sdbusplus::message::variant<std::string>("yyyxxx")); |
| 320 | b.call(m); |
| 321 | |
| 322 | std::string sigInterface; |
Brad Bishop | 7b33777 | 2017-01-12 16:11:24 -0500 | [diff] [blame] | 323 | std::map < |
| 324 | std::string, |
| 325 | sdbusplus::message::variant<std::string >> sigProperties; |
Brad Bishop | 22ecacc | 2016-12-01 08:38:06 -0500 | [diff] [blame] | 326 | { |
| 327 | std::vector<std::string> interfaces; |
| 328 | auto sig{queue.pop()}; |
| 329 | sig.read(sigInterface); |
| 330 | assert(sigInterface == "xyz.openbmc_project.Example.Iface1"); |
| 331 | sig.read(sigProperties); |
| 332 | assert(sigProperties["ExampleProperty1"] == "changed"); |
| 333 | } |
| 334 | } |
| 335 | } |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | int main() |
| 339 | { |
Brad Bishop | 6524758 | 2017-01-15 19:48:41 -0500 | [diff] [blame] | 340 | phosphor::inventory::manager::Manager mgr( |
| 341 | sdbusplus::bus::new_default(), |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 342 | MGR_SERVICE, MGR_ROOT, MGR_INTERFACE); |
| 343 | ExampleService d; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 344 | |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 345 | auto f1 = [](auto mgr) |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 346 | { |
Brad Bishop | 2162143 | 2017-01-13 16:35:53 -0500 | [diff] [blame] | 347 | mgr->run(); |
| 348 | }; |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 349 | auto f2 = [](auto d) |
| 350 | { |
| 351 | d->run(); |
| 352 | }; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 353 | |
Brad Bishop | 8f86850 | 2017-01-23 13:13:58 -0500 | [diff] [blame^] | 354 | auto t1 = std::thread(f1, &mgr); |
| 355 | auto t2 = std::thread(f2, &d); |
| 356 | |
| 357 | runTests(); |
| 358 | |
| 359 | mgr.shutdown(); |
| 360 | d.shutdown = true; |
| 361 | |
| 362 | // Wait for server threads to exit. |
| 363 | t1.join(); |
| 364 | t2.join(); |
| 365 | std::cout << "Success! Waiting for threads to exit..." << std::endl; |
Brad Bishop | 49aefb3 | 2016-10-19 11:54:14 -0400 | [diff] [blame] | 366 | |
| 367 | return 0; |
| 368 | } |
| 369 | |
| 370 | // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 |