Run astyle
Change-Id: Iec4802e9837465a7deb1fd7fd57a2068cc18c50d
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/test/test.cpp b/test/test.cpp
index 13b8934..550e83f 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -23,13 +23,13 @@
constexpr auto INTERFACE = IFACE;
constexpr auto ROOT = "/testing/inventory";
-auto server_thread(void *data)
+auto server_thread(void* data)
{
auto mgr = static_cast<phosphor::inventory::manager::Manager*>(data);
mgr->run();
- return static_cast<void *>(nullptr);
+ return static_cast<void*>(nullptr);
}
/** @class SignalQueue
@@ -38,109 +38,113 @@
class SignalQueue
{
public:
- ~SignalQueue() = default;
- SignalQueue() = delete;
- SignalQueue(const SignalQueue &) = delete;
- SignalQueue(SignalQueue &&) = default;
- SignalQueue& operator=(const SignalQueue &) = delete;
- SignalQueue& operator=(SignalQueue &&) = default;
- explicit SignalQueue(const std::string &match) :
- _bus(sdbusplus::bus::new_default()),
- _match(_bus, match.c_str(), &callback, this),
- _next(nullptr)
- {
- }
-
- auto &&pop(unsigned timeout=1000000)
- {
- while(timeout > 0 && !_next)
+ ~SignalQueue() = default;
+ SignalQueue() = delete;
+ SignalQueue(const SignalQueue&) = delete;
+ SignalQueue(SignalQueue&&) = default;
+ SignalQueue& operator=(const SignalQueue&) = delete;
+ SignalQueue& operator=(SignalQueue&&) = default;
+ explicit SignalQueue(const std::string& match) :
+ _bus(sdbusplus::bus::new_default()),
+ _match(_bus, match.c_str(), &callback, this),
+ _next(nullptr)
{
- _bus.process_discard();
- _bus.wait(50000);
- timeout -= 50000;
}
- return std::move(_next);
- }
+
+ auto&& pop(unsigned timeout = 1000000)
+ {
+ while (timeout > 0 && !_next)
+ {
+ _bus.process_discard();
+ _bus.wait(50000);
+ timeout -= 50000;
+ }
+ return std::move(_next);
+ }
private:
- static int callback(sd_bus_message *m, void *context, sd_bus_error *)
- {
- auto *me = static_cast<SignalQueue *>(context);
- sd_bus_message_ref(m);
- sdbusplus::message::message msg{m};
- me->_next = std::move(msg);
- return 0;
- }
+ static int callback(sd_bus_message* m, void* context, sd_bus_error*)
+ {
+ auto* me = static_cast<SignalQueue*>(context);
+ sd_bus_message_ref(m);
+ sdbusplus::message::message msg{m};
+ me->_next = std::move(msg);
+ return 0;
+ }
- sdbusplus::bus::bus _bus;
- sdbusplus::server::match::match _match;
- sdbusplus::message::message _next;
+ sdbusplus::bus::bus _bus;
+ sdbusplus::server::match::match _match;
+ sdbusplus::message::message _next;
};
template <typename ...T>
-using Object = std::map<
- std::string,
- std::map<
- std::string,
- sdbusplus::message::variant<T...>>>;
+using Object = std::map <
+ std::string,
+ std::map <
+ std::string,
+ sdbusplus::message::variant<T... >>>;
using ObjectPath = std::string;
/**@brief Find a subset of interfaces and properties in an object. */
template <typename ...T>
-auto hasProperties(const Object<T...> &l, const Object<T...> &r)
+auto hasProperties(const Object<T...>& l, const Object<T...>& r)
{
Object<T...> result;
std::set_difference(
- r.cbegin(),
- r.cend(),
- l.cbegin(),
- l.cend(),
- std::inserter(result, result.end()));
+ r.cbegin(),
+ r.cend(),
+ l.cbegin(),
+ l.cend(),
+ std::inserter(result, result.end()));
return result.empty();
}
/**@brief Check an object for one or more interfaces. */
template <typename ...T>
-auto hasInterfaces(const std::vector<std::string> &l, const Object<T...> &r)
+auto hasInterfaces(const std::vector<std::string>& l, const Object<T...>& r)
{
std::vector<std::string> stripped, interfaces;
std::transform(
- r.cbegin(),
- r.cend(),
- std::back_inserter(stripped),
- [](auto &p){ return p.first; });
+ r.cbegin(),
+ r.cend(),
+ std::back_inserter(stripped),
+ [](auto & p)
+ {
+ return p.first;
+ });
std::set_difference(
- stripped.cbegin(),
- stripped.cend(),
- l.cbegin(),
- l.cend(),
- std::back_inserter(interfaces));
+ stripped.cbegin(),
+ stripped.cend(),
+ l.cbegin(),
+ l.cend(),
+ std::back_inserter(interfaces));
return interfaces.empty();
}
-void runTests(phosphor::inventory::manager::Manager &mgr)
+void runTests(phosphor::inventory::manager::Manager& mgr)
{
const std::string root{ROOT};
auto b = sdbusplus::bus::new_default();
auto notify = [&]()
{
return b.new_method_call(
- SERVICE,
- ROOT,
- INTERFACE,
- "Notify");
+ SERVICE,
+ ROOT,
+ INTERFACE,
+ "Notify");
};
- auto set = [&](const std::string &path)
+ auto set = [&](const std::string & path)
{
return b.new_method_call(
- SERVICE,
- path.c_str(),
- "org.freedesktop.DBus.Properties",
- "Set");
+ SERVICE,
+ path.c_str(),
+ "org.freedesktop.DBus.Properties",
+ "Set");
};
- Object<std::string> obj{
+ Object<std::string> obj
+ {
{
"xyz.openbmc_project.Example.Iface1",
{{"ExampleProperty1", "test1"}}
@@ -157,7 +161,7 @@
ObjectPath path{root + relPath};
SignalQueue queue(
- "path='" + root + "',member='InterfacesAdded'");
+ "path='" + root + "',member='InterfacesAdded'");
auto m = notify();
m.append(relPath);
@@ -210,7 +214,7 @@
// Set a property that should not trigger due to a filter.
{
SignalQueue queue(
- "path='" + root + "',member='InterfacesRemoved'");
+ "path='" + root + "',member='InterfacesRemoved'");
auto m = set(triggerOne);
m.append("xyz.openbmc_project.Example.Iface2");
m.append("ExampleProperty2");
@@ -223,7 +227,7 @@
// Set a property that should trigger.
{
SignalQueue queue(
- "path='" + root + "',member='InterfacesRemoved'");
+ "path='" + root + "',member='InterfacesRemoved'");
auto m = set(triggerOne);
m.append("xyz.openbmc_project.Example.Iface2");
@@ -287,7 +291,7 @@
// Trigger and validate the change.
{
SignalQueue queue(
- "path='" + changeMe + "',member='PropertiesChanged'");
+ "path='" + changeMe + "',member='PropertiesChanged'");
auto m = set(triggerTwo);
m.append("xyz.openbmc_project.Example.Iface2");
m.append("ExampleProperty2");
@@ -295,9 +299,9 @@
b.call(m);
std::string sigInterface;
- std::map<
- std::string,
- sdbusplus::message::variant<std::string>> sigProperties;
+ std::map <
+ std::string,
+ sdbusplus::message::variant<std::string >> sigProperties;
{
std::vector<std::string> interfaces;
auto sig{queue.pop()};
@@ -316,8 +320,8 @@
int main()
{
auto mgr = phosphor::inventory::manager::Manager(
- sdbusplus::bus::new_default(),
- SERVICE, ROOT, INTERFACE);
+ sdbusplus::bus::new_default(),
+ SERVICE, ROOT, INTERFACE);
pthread_t t;
{