Add clang-format to repo
Add clang-format to repo.
Change-Id: Ib3f81524b66414df3e6c93d8a6df6e22c43841e0
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..ea71ad6
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,99 @@
+---
+Language: Cpp
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlinesLeft: false
+AlignOperands: true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+ AfterClass: true
+ AfterControlStatement: true
+ AfterEnum: true
+ AfterFunction: true
+ AfterNamespace: true
+ AfterObjCDeclaration: true
+ AfterStruct: true
+ AfterUnion: true
+ BeforeCatch: true
+ BeforeElse: true
+ IndentBraces: false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializers: AfterColon
+ColumnLimit: 80
+CommentPragmas: '^ IWYU pragma:'
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+PointerAlignment: Left
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 5
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.hpp"'
+ Priority: 1
+ - Regex: '^<.*\.h>'
+ Priority: 2
+ - Regex: '^<.*'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
+IndentCaseLabels: true
+IndentWidth: 4
+IndentWrappedFunctionNames: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+ReflowComments: true
+SortIncludes: true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles: false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard: Cpp11
+TabWidth: 4
+UseTab: Never
+...
+
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 95c80e7..b9121c7 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -2,13 +2,12 @@
// See elog-gen.py for more details
#pragma once
+#include <phosphor-logging/elog.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/exception.hpp>
#include <string>
#include <tuple>
#include <type_traits>
-#include <sdbusplus/exception.hpp>
-#include <phosphor-logging/log.hpp>
-#include <phosphor-logging/elog.hpp>
-
namespace sdbusplus
{
@@ -24,7 +23,7 @@
{
namespace Error
{
- struct InventoryPathError;
+struct InventoryPathError;
} // namespace Error
} // namespace Monitor
} // namespace Fru
@@ -45,7 +44,7 @@
{
namespace Error
{
- struct ObjectNotFoundError;
+struct ObjectNotFoundError;
} // namespace Error
} // namespace Mapper
} // namespace Led
@@ -65,7 +64,7 @@
{
namespace Error
{
- struct MethodError;
+struct MethodError;
} // namespace Error
} // namespace Mapper
} // namespace Led
@@ -73,7 +72,6 @@
} // namespace xyz
} // namespace sdbusplus
-
namespace phosphor
{
@@ -97,16 +95,17 @@
{
static constexpr auto str = "PATH=%s";
static constexpr auto str_short = "PATH";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr PATH(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr PATH(const char* a) : _entry(entry(str, a)){};
type _entry;
};
-} // namespace _InventoryPathError
+} // namespace _InventoryPathError
struct InventoryPathError : public sdbusplus::exception_t
{
- static constexpr auto errName = "xyz.openbmc_project.Led.Fru.Monitor.InventoryPathError";
+ static constexpr auto errName =
+ "xyz.openbmc_project.Led.Fru.Monitor.InventoryPathError";
static constexpr auto errDesc = "Invalid Inventory Path.";
static constexpr auto L = level::INFO;
using PATH = _InventoryPathError::PATH;
@@ -134,17 +133,17 @@
} // namespace openbmc_project
} // namespace xyz
-
namespace details
{
template <>
-struct map_exception_type<sdbusplus::xyz::openbmc_project::Led::Fru::Monitor::Error::InventoryPathError>
+struct map_exception_type<sdbusplus::xyz::openbmc_project::Led::Fru::Monitor::
+ Error::InventoryPathError>
{
using type = xyz::openbmc_project::Led::Fru::Monitor::InventoryPathError;
};
-}
+} // namespace details
namespace xyz
{
@@ -161,32 +160,33 @@
{
static constexpr auto str = "METHOD_NAME=%s";
static constexpr auto str_short = "METHOD_NAME";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr METHOD_NAME(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr METHOD_NAME(const char* a) : _entry(entry(str, a)){};
type _entry;
};
struct PATH
{
static constexpr auto str = "PATH=%s";
static constexpr auto str_short = "PATH";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr PATH(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr PATH(const char* a) : _entry(entry(str, a)){};
type _entry;
};
struct INTERFACE
{
static constexpr auto str = "INTERFACE=%s";
static constexpr auto str_short = "INTERFACE";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr INTERFACE(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr INTERFACE(const char* a) : _entry(entry(str, a)){};
type _entry;
};
-} // namespace _MethodError
+} // namespace _MethodError
struct MethodError : public sdbusplus::exception_t
{
- static constexpr auto errName = "xyz.openbmc_project.Led.Mapper.MethodError";
+ static constexpr auto errName =
+ "xyz.openbmc_project.Led.Mapper.MethodError";
static constexpr auto errDesc = "Failed to invoke ObjectMapper method";
static constexpr auto L = level::INFO;
using METHOD_NAME = _MethodError::METHOD_NAME;
@@ -215,17 +215,17 @@
} // namespace openbmc_project
} // namespace xyz
-
namespace details
{
template <>
-struct map_exception_type<sdbusplus::xyz::openbmc_project::Led::Mapper::Error::MethodError>
+struct map_exception_type<
+ sdbusplus::xyz::openbmc_project::Led::Mapper::Error::MethodError>
{
using type = xyz::openbmc_project::Led::Mapper::MethodError;
};
-}
+} // namespace details
namespace xyz
{
@@ -242,32 +242,33 @@
{
static constexpr auto str = "METHOD_NAME=%s";
static constexpr auto str_short = "METHOD_NAME";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr METHOD_NAME(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr METHOD_NAME(const char* a) : _entry(entry(str, a)){};
type _entry;
};
struct PATH
{
static constexpr auto str = "PATH=%s";
static constexpr auto str_short = "PATH";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr PATH(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr PATH(const char* a) : _entry(entry(str, a)){};
type _entry;
};
struct INTERFACE
{
static constexpr auto str = "INTERFACE=%s";
static constexpr auto str_short = "INTERFACE";
- using type = std::tuple<std::decay_t<decltype(str)>,const char*>;
- explicit constexpr INTERFACE(const char* a) : _entry(entry(str, a)) {};
+ using type = std::tuple<std::decay_t<decltype(str)>, const char*>;
+ explicit constexpr INTERFACE(const char* a) : _entry(entry(str, a)){};
type _entry;
};
-} // namespace _ObjectNotFoundError
+} // namespace _ObjectNotFoundError
struct ObjectNotFoundError : public sdbusplus::exception_t
{
- static constexpr auto errName = "xyz.openbmc_project.Led.Mapper.ObjectNotFoundError";
+ static constexpr auto errName =
+ "xyz.openbmc_project.Led.Mapper.ObjectNotFoundError";
static constexpr auto errDesc = "Failed to get response from the method.";
static constexpr auto L = level::INFO;
using METHOD_NAME = _ObjectNotFoundError::METHOD_NAME;
@@ -296,18 +297,17 @@
} // namespace openbmc_project
} // namespace xyz
-
namespace details
{
template <>
-struct map_exception_type<sdbusplus::xyz::openbmc_project::Led::Mapper::Error::ObjectNotFoundError>
+struct map_exception_type<
+ sdbusplus::xyz::openbmc_project::Led::Mapper::Error::ObjectNotFoundError>
{
using type = xyz::openbmc_project::Led::Mapper::ObjectNotFoundError;
};
-}
-
+} // namespace details
} // namespace logging
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp
index aecb481..a7ed952 100644
--- a/fault-monitor/fru-fault-monitor.cpp
+++ b/fault-monitor/fru-fault-monitor.cpp
@@ -1,9 +1,11 @@
-#include <phosphor-logging/elog.hpp>
-#include <sdbusplus/exception.hpp>
+#include "fru-fault-monitor.hpp"
+
+#include "elog-errors.hpp"
#include "xyz/openbmc_project/Led/Fru/Monitor/error.hpp"
#include "xyz/openbmc_project/Led/Mapper/error.hpp"
-#include "elog-errors.hpp"
-#include "fru-fault-monitor.hpp"
+
+#include <phosphor-logging/elog.hpp>
+#include <sdbusplus/exception.hpp>
namespace phosphor
{
@@ -18,17 +20,17 @@
using namespace phosphor::logging;
-constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
-constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
-constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
-constexpr auto OBJMGR_IFACE = "org.freedesktop.DBus.ObjectManager";
-constexpr auto LED_GROUPS = "/xyz/openbmc_project/led/groups/";
-constexpr auto LOG_PATH = "/xyz/openbmc_project/logging";
-constexpr auto LOG_IFACE = "xyz.openbmc_project.Logging.Entry";
+constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
+constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
+constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
+constexpr auto OBJMGR_IFACE = "org.freedesktop.DBus.ObjectManager";
+constexpr auto LED_GROUPS = "/xyz/openbmc_project/led/groups/";
+constexpr auto LOG_PATH = "/xyz/openbmc_project/logging";
+constexpr auto LOG_IFACE = "xyz.openbmc_project.Logging.Entry";
-using AssociationList = std::vector<std::tuple<
- std::string, std::string, std::string>>;
-using Attributes = sdbusplus::message::variant<bool,AssociationList>;
+using AssociationList =
+ std::vector<std::tuple<std::string, std::string, std::string>>;
+using Attributes = sdbusplus::message::variant<bool, AssociationList>;
using PropertyName = std::string;
using PropertyMap = std::map<PropertyName, Attributes>;
using InterfaceName = std::string;
@@ -40,30 +42,25 @@
using Interfaces = std::vector<Interface>;
using MapperResponseType = std::map<Path, std::map<Service, Interfaces>>;
-using MethodErr =
+using MethodErr =
sdbusplus::xyz::openbmc_project::Led::Mapper::Error::MethodError;
using ObjectNotFoundErr =
sdbusplus::xyz::openbmc_project::Led::Mapper::Error::ObjectNotFoundError;
-using InventoryPathErr =
- sdbusplus::xyz::openbmc_project::
- Led::Fru::Monitor::Error::InventoryPathError;
+using InventoryPathErr = sdbusplus::xyz::openbmc_project::Led::Fru::Monitor::
+ Error::InventoryPathError;
-std::string getService(sdbusplus::bus::bus& bus,
- const std::string& path)
+std::string getService(sdbusplus::bus::bus& bus, const std::string& path)
{
- auto mapper = bus.new_method_call(MAPPER_BUSNAME,
- MAPPER_OBJ_PATH,
+ auto mapper = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
MAPPER_IFACE, "GetObject");
mapper.append(path.c_str(), std::vector<std::string>({OBJMGR_IFACE}));
auto mapperResponseMsg = bus.call(mapper);
if (mapperResponseMsg.is_method_error())
{
using namespace xyz::openbmc_project::Led::Mapper;
- elog<MethodErr>(
- MethodError::METHOD_NAME("GetObject"),
- MethodError::PATH(path.c_str()),
- MethodError::INTERFACE(
- OBJMGR_IFACE));
+ elog<MethodErr>(MethodError::METHOD_NAME("GetObject"),
+ MethodError::PATH(path.c_str()),
+ MethodError::INTERFACE(OBJMGR_IFACE));
}
std::map<std::string, std::vector<std::string>> mapperResponse;
@@ -73,32 +70,27 @@
}
catch (const sdbusplus::exception::SdBusError& e)
{
- log<level::ERR>("Failed to parse getService mapper response",
- entry("ERROR=%s", e.what()),
- entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
+ log<level::ERR>(
+ "Failed to parse getService mapper response",
+ entry("ERROR=%s", e.what()),
+ entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
using namespace xyz::openbmc_project::Led::Mapper;
- elog<ObjectNotFoundErr>(
- ObjectNotFoundError::METHOD_NAME("GetObject"),
- ObjectNotFoundError::PATH(path.c_str()),
- ObjectNotFoundError::INTERFACE(
- OBJMGR_IFACE));
+ elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
+ ObjectNotFoundError::PATH(path.c_str()),
+ ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
}
if (mapperResponse.empty())
{
using namespace xyz::openbmc_project::Led::Mapper;
- elog<ObjectNotFoundErr>(
- ObjectNotFoundError::METHOD_NAME("GetObject"),
- ObjectNotFoundError::PATH(path.c_str()),
- ObjectNotFoundError::INTERFACE(
- OBJMGR_IFACE));
+ elog<ObjectNotFoundErr>(ObjectNotFoundError::METHOD_NAME("GetObject"),
+ ObjectNotFoundError::PATH(path.c_str()),
+ ObjectNotFoundError::INTERFACE(OBJMGR_IFACE));
}
return mapperResponse.cbegin()->first;
}
-void action(sdbusplus::bus::bus& bus,
- const std::string& path,
- bool assert)
+void action(sdbusplus::bus::bus& bus, const std::string& path, bool assert)
{
std::string service;
try
@@ -122,20 +114,15 @@
if (pos == std::string::npos)
{
using namespace xyz::openbmc_project::Led::Fru::Monitor;
- report<InventoryPathErr>(
- InventoryPathError::PATH(
- path.c_str()));
+ report<InventoryPathErr>(InventoryPathError::PATH(path.c_str()));
return;
}
auto unit = path.substr(pos + 1);
- std::string ledPath = LED_GROUPS +
- unit + '_' + LED_FAULT;
+ std::string ledPath = LED_GROUPS + unit + '_' + LED_FAULT;
- auto method = bus.new_method_call(service.c_str(),
- ledPath.c_str(),
- "org.freedesktop.DBus.Properties",
- "Set");
+ auto method = bus.new_method_call(service.c_str(), ledPath.c_str(),
+ "org.freedesktop.DBus.Properties", "Set");
method.append("xyz.openbmc_project.Led.Group");
method.append("Asserted");
@@ -176,7 +163,7 @@
std::size_t found = objectPath.str.find(ELOG_ENTRY);
if (found == std::string::npos)
{
- //Not a new error entry skip
+ // Not a new error entry skip
return;
}
auto iter = interfaces.find("org.openbmc.Associations");
@@ -185,8 +172,8 @@
return;
}
- //Nothing else shows when a specific error log
- //has been created. Do it here.
+ // Nothing else shows when a specific error log
+ // has been created. Do it here.
std::string message{objectPath.str + " created"};
log<level::INFO>(message.c_str());
@@ -200,7 +187,7 @@
sdbusplus::message::variant_ns::get<AssociationList>(attr->second);
if (assocs.empty())
{
- //No associations skip
+ // No associations skip
return;
}
@@ -220,10 +207,8 @@
void getLoggingSubTree(sdbusplus::bus::bus& bus, MapperResponseType& subtree)
{
auto depth = 0;
- auto mapperCall = bus.new_method_call(MAPPER_BUSNAME,
- MAPPER_OBJ_PATH,
- MAPPER_IFACE,
- "GetSubTree");
+ auto mapperCall = bus.new_method_call(MAPPER_BUSNAME, MAPPER_OBJ_PATH,
+ MAPPER_IFACE, "GetSubTree");
mapperCall.append("/");
mapperCall.append(depth);
mapperCall.append(std::vector<Interface>({LOG_IFACE}));
@@ -234,10 +219,9 @@
if (mapperResponseMsg.is_method_error())
{
using namespace xyz::openbmc_project::Led::Mapper;
- report<MethodErr>(
- MethodError::METHOD_NAME("GetSubTree"),
- MethodError::PATH(MAPPER_OBJ_PATH),
- MethodError::INTERFACE(OBJMGR_IFACE));
+ report<MethodErr>(MethodError::METHOD_NAME("GetSubTree"),
+ MethodError::PATH(MAPPER_OBJ_PATH),
+ MethodError::INTERFACE(OBJMGR_IFACE));
return;
}
@@ -247,9 +231,10 @@
}
catch (const sdbusplus::exception::SdBusError& e)
{
- log<level::ERR>("Failed to parse existing callouts subtree message",
- entry("ERROR=%s", e.what()),
- entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
+ log<level::ERR>(
+ "Failed to parse existing callouts subtree message",
+ entry("ERROR=%s", e.what()),
+ entry("REPLY_SIG=%s", mapperResponseMsg.get_signature()));
}
}
catch (const sdbusplus::exception::SdBusError& e)
@@ -260,27 +245,26 @@
void Add::processExistingCallouts(sdbusplus::bus::bus& bus)
{
- MapperResponseType mapperResponse;
+ MapperResponseType mapperResponse;
getLoggingSubTree(bus, mapperResponse);
if (mapperResponse.empty())
{
- //No errors to process.
+ // No errors to process.
return;
}
for (const auto& elem : mapperResponse)
{
- auto method = bus.new_method_call(elem.second.begin()->first.c_str(),
- elem.first.c_str(),
- "org.freedesktop.DBus.Properties",
- "Get");
+ auto method = bus.new_method_call(
+ elem.second.begin()->first.c_str(), elem.first.c_str(),
+ "org.freedesktop.DBus.Properties", "Get");
method.append("org.openbmc.Associations");
method.append("associations");
auto reply = bus.call(method);
if (reply.is_method_error())
{
- //do not stop, continue with next elog
+ // do not stop, continue with next elog
log<level::ERR>("Error in getting associations");
continue;
}
@@ -292,15 +276,16 @@
}
catch (const sdbusplus::exception::SdBusError& e)
{
- log<level::ERR>("Failed to parse existing callouts associations message",
- entry("ERROR=%s", e.what()),
- entry("REPLY_SIG=%s", reply.get_signature()));
+ log<level::ERR>(
+ "Failed to parse existing callouts associations message",
+ entry("ERROR=%s", e.what()),
+ entry("REPLY_SIG=%s", reply.get_signature()));
continue;
}
auto& assocs = assoc.get<AssociationList>();
if (assocs.empty())
{
- //no associations, skip
+ // no associations, skip
continue;
}
@@ -324,8 +309,8 @@
return;
}
-}//namespace monitor
-}//namespace fault
-}//namespace fru
-}//namespace led
-}//namespace phosphor
+} // namespace monitor
+} // namespace fault
+} // namespace fru
+} // namespace led
+} // namespace phosphor
diff --git a/fault-monitor/fru-fault-monitor.hpp b/fault-monitor/fru-fault-monitor.hpp
index 77d3be2..54eb655 100644
--- a/fault-monitor/fru-fault-monitor.hpp
+++ b/fault-monitor/fru-fault-monitor.hpp
@@ -1,8 +1,9 @@
#pragma once
+#include "config.h"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
-#include "config.h"
namespace phosphor
{
@@ -16,13 +17,11 @@
{
/** @brief Assert or deassert an LED based on the input FRU
- * @param[in] bus - The Dbus bus object
- * @param[in] path - Inventory path of the FRU
- * @param[in] assert - Assert if true deassert if false
- */
-void action(sdbusplus::bus::bus& bus,
- const std::string& path,
- bool assert);
+ * @param[in] bus - The Dbus bus object
+ * @param[in] path - Inventory path of the FRU
+ * @param[in] assert - Assert if true deassert if false
+ */
+void action(sdbusplus::bus::bus& bus, const std::string& path, bool assert);
class Remove;
@@ -33,44 +32,43 @@
*/
class Add
{
- public:
- Add() = delete;
- ~Add() = default;
- Add(const Add&) = delete;
- Add& operator=(const Add&) = delete;
- Add(Add&&) = default;
- Add& operator=(Add&&) = default;
+ public:
+ Add() = delete;
+ ~Add() = default;
+ Add(const Add&) = delete;
+ Add& operator=(const Add&) = delete;
+ Add(Add&&) = default;
+ Add& operator=(Add&&) = default;
- /** @brief constructs Add a watch for FRU faults.
- * @param[in] bus - The Dbus bus object
- */
- Add(sdbusplus::bus::bus& bus):
- matchCreated(
- bus,
- sdbusplus::bus::match::rules::interfacesAdded() +
+ /** @brief constructs Add a watch for FRU faults.
+ * @param[in] bus - The Dbus bus object
+ */
+ Add(sdbusplus::bus::bus& bus) :
+ matchCreated(
+ bus,
+ sdbusplus::bus::match::rules::interfacesAdded() +
sdbusplus::bus::match::rules::path_namespace(
- "/xyz/openbmc_project/logging"),
- std::bind(std::mem_fn(&Add::created),
- this, std::placeholders::_1))
- {
- processExistingCallouts(bus);
- }
- private:
+ "/xyz/openbmc_project/logging"),
+ std::bind(std::mem_fn(&Add::created), this, std::placeholders::_1))
+ {
+ processExistingCallouts(bus);
+ }
- /** @brief sdbusplus signal match for fault created */
- sdbusplus::bus::match_t matchCreated;
+ private:
+ /** @brief sdbusplus signal match for fault created */
+ sdbusplus::bus::match_t matchCreated;
- std::vector<std::unique_ptr<Remove>> removeWatches;
+ std::vector<std::unique_ptr<Remove>> removeWatches;
- /** @brief Callback function for fru fault created
- * @param[in] msg - Data associated with subscribed signal
- */
- void created(sdbusplus::message::message& msg);
+ /** @brief Callback function for fru fault created
+ * @param[in] msg - Data associated with subscribed signal
+ */
+ void created(sdbusplus::message::message& msg);
- /** @brief This function process all callouts at application start
- * @param[in] bus - The Dbus bus object
- */
- void processExistingCallouts(sdbusplus::bus::bus& bus);
+ /** @brief This function process all callouts at application start
+ * @param[in] bus - The Dbus bus object
+ */
+ void processExistingCallouts(sdbusplus::bus::bus& bus);
};
/** @class Remove
@@ -80,59 +78,55 @@
*/
class Remove
{
- public:
- Remove() = delete;
- ~Remove() = default;
- Remove(const Remove&) = delete;
- Remove& operator=(const Remove&) = delete;
- Remove(Remove&&) = default;
- Remove& operator=(Remove&&) = default;
+ public:
+ Remove() = delete;
+ ~Remove() = default;
+ Remove(const Remove&) = delete;
+ Remove& operator=(const Remove&) = delete;
+ Remove(Remove&&) = default;
+ Remove& operator=(Remove&&) = default;
- /** @brief constructs Remove
- * @param[in] bus - The Dbus bus object
- * @param[in] path - Inventory path to fru
- */
- Remove(sdbusplus::bus::bus& bus, const std::string& path):
- inventoryPath(path),
- matchRemoved(
- bus,
- match(path),
- std::bind(std::mem_fn(&Remove::removed),
- this, std::placeholders::_1))
- {
- //Do nothing
- }
+ /** @brief constructs Remove
+ * @param[in] bus - The Dbus bus object
+ * @param[in] path - Inventory path to fru
+ */
+ Remove(sdbusplus::bus::bus& bus, const std::string& path) :
+ inventoryPath(path),
+ matchRemoved(bus, match(path),
+ std::bind(std::mem_fn(&Remove::removed), this,
+ std::placeholders::_1))
+ {
+ // Do nothing
+ }
- private:
+ private:
+ /** @brief inventory path of the FRU */
+ std::string inventoryPath;
- /** @brief inventory path of the FRU */
- std::string inventoryPath;
+ /** @brief sdbusplus signal matches for fault removed */
+ sdbusplus::bus::match_t matchRemoved;
- /** @brief sdbusplus signal matches for fault removed */
- sdbusplus::bus::match_t matchRemoved;
+ /** @brief Callback function for fru fault created
+ * @param[in] msg - Data associated with subscribed signal
+ */
+ void removed(sdbusplus::message::message& msg);
- /** @brief Callback function for fru fault created
- * @param[in] msg - Data associated with subscribed signal
- */
- void removed(sdbusplus::message::message& msg);
+ /** @brief function to create fault remove match for a fru
+ * @param[in] path - Inventory path of the faulty unit.
+ */
+ std::string match(const std::string& path)
+ {
+ namespace MatchRules = sdbusplus::bus::match::rules;
- /** @brief function to create fault remove match for a fru
- * @param[in] path - Inventory path of the faulty unit.
- */
- std::string match(const std::string& path)
- {
- namespace MatchRules = sdbusplus::bus::match::rules;
+ std::string matchStmt =
+ MatchRules::interfacesRemoved() +
+ MatchRules::argNpath(0, path + "/" + CALLOUT_REV_ASSOCIATION);
- std::string matchStmt =
- MatchRules::interfacesRemoved() +
- MatchRules::argNpath(
- 0, path + "/" + CALLOUT_REV_ASSOCIATION);
-
- return matchStmt;
- }
+ return matchStmt;
+ }
};
-}//namespace monitor
-}//namespace fault
-}//namespace fru
-}//namespace led
-}//namespace phosphor
+} // namespace monitor
+} // namespace fault
+} // namespace fru
+} // namespace led
+} // namespace phosphor
diff --git a/group.cpp b/group.cpp
index 6c0f06a..0d4fa10 100644
--- a/group.cpp
+++ b/group.cpp
@@ -1,5 +1,6 @@
-#include <sdbusplus/message.hpp>
#include "group.hpp"
+
+#include <sdbusplus/message.hpp>
namespace phosphor
{
namespace led
@@ -9,14 +10,13 @@
bool Group::asserted(bool value)
{
// Introducing these to enable gtest.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
// Group management is handled by Manager. The populated leds* sets are not
// really used by production code. They are there to enable gtest for
// validation.
- auto result = manager.setGroupState(path, value, ledsAssert,
- ledsDeAssert);
+ auto result = manager.setGroupState(path, value, ledsAssert, ledsDeAssert);
// If something does not go right here, then there should be an sdbusplus
// exception thrown.
@@ -24,8 +24,8 @@
// Set the base class's asserted to 'true' since the getter
// operation is handled there.
- return sdbusplus::xyz::openbmc_project::Led::server::
- Group::asserted(result);
+ return sdbusplus::xyz::openbmc_project::Led::server::Group::asserted(
+ result);
}
} // namespace led
diff --git a/group.hpp b/group.hpp
index 34f7afd..4e0a283 100644
--- a/group.hpp
+++ b/group.hpp
@@ -1,9 +1,10 @@
#pragma once
+#include "manager.hpp"
+
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/object.hpp>
#include <xyz/openbmc_project/Led/Group/server.hpp>
-#include "manager.hpp"
namespace phosphor
{
namespace led
@@ -13,48 +14,46 @@
* @brief Manages group of LEDs and applies action on the elements of group
*/
class Group : sdbusplus::server::object::object<
- sdbusplus::xyz::openbmc_project::Led::server::Group>
+ sdbusplus::xyz::openbmc_project::Led::server::Group>
{
- public:
- Group() = delete;
- ~Group() = default;
- Group(const Group&) = delete;
- Group& operator=(const Group&) = delete;
- Group(Group&&) = default;
- Group& operator=(Group&&) = default;
+ public:
+ Group() = delete;
+ ~Group() = default;
+ Group(const Group&) = delete;
+ Group& operator=(const Group&) = delete;
+ Group(Group&&) = default;
+ Group& operator=(Group&&) = default;
- /** @brief Constructs LED Group
- *
- * @param[in] bus - Handle to system dbus
- * @param[in] objPath - The Dbus path that hosts LED group
- * @param[in] manager - Reference to Manager
- */
- Group(sdbusplus::bus::bus& bus,
- const std::string& objPath,
- Manager& manager) :
+ /** @brief Constructs LED Group
+ *
+ * @param[in] bus - Handle to system dbus
+ * @param[in] objPath - The Dbus path that hosts LED group
+ * @param[in] manager - Reference to Manager
+ */
+ Group(sdbusplus::bus::bus& bus, const std::string& objPath,
+ Manager& manager) :
- sdbusplus::server::object::object<
+ sdbusplus::server::object::object<
sdbusplus::xyz::openbmc_project::Led::server::Group>(
- bus, objPath.c_str()),
- path(objPath),
- manager(manager)
- {
- // Nothing to do here
- }
+ bus, objPath.c_str()),
+ path(objPath), manager(manager)
+ {
+ // Nothing to do here
+ }
- /** @brief Property SET Override function
- *
- * @param[in] value - True or False
- * @return - Success or exception thrown
- */
- bool asserted(bool value) override;
+ /** @brief Property SET Override function
+ *
+ * @param[in] value - True or False
+ * @return - Success or exception thrown
+ */
+ bool asserted(bool value) override;
- private:
- /** @brief Path of the group instance */
- std::string path;
+ private:
+ /** @brief Path of the group instance */
+ std::string path;
- /** @brief Reference to Manager object */
- Manager& manager;
+ /** @brief Reference to Manager object */
+ Manager& manager;
};
} // namespace led
diff --git a/led-main.cpp b/led-main.cpp
index 4df1a6a..cc0e6cf 100644
--- a/led-main.cpp
+++ b/led-main.cpp
@@ -1,9 +1,11 @@
-#include <iostream>
+#include "config.h"
+
+#include "group.hpp"
+#include "led-gen.hpp"
#include "ledlayout.hpp"
#include "manager.hpp"
-#include "group.hpp"
-#include "config.h"
-#include "led-gen.hpp"
+
+#include <iostream>
int main(void)
{
@@ -20,17 +22,17 @@
std::vector<std::unique_ptr<phosphor::led::Group>> groups;
/** Now create so many dbus objects as there are groups */
- for (auto &grp: systemLedMap)
+ for (auto& grp : systemLedMap)
{
- groups.emplace_back(std::make_unique<phosphor::led::Group>(
- bus, grp.first, manager));
+ groups.emplace_back(
+ std::make_unique<phosphor::led::Group>(bus, grp.first, manager));
}
/** @brief Claim the bus */
bus.request_name(BUSNAME);
/** @brief Wait for client requests */
- while(true)
+ while (true)
{
/** @brief process dbus calls / signals discarding unhandled */
bus.process_discard();
diff --git a/ledlayout.hpp b/ledlayout.hpp
index 75c2d20..90b333c 100644
--- a/ledlayout.hpp
+++ b/ledlayout.hpp
@@ -12,46 +12,46 @@
*/
namespace Layout
{
- /** @brief Define possible actions on a given LED.
- * For the BLINK operation, follow 50-50 duty cycle
- */
- enum Action
- {
- Off,
- On,
- Blink,
- };
+/** @brief Define possible actions on a given LED.
+ * For the BLINK operation, follow 50-50 duty cycle
+ */
+enum Action
+{
+ Off,
+ On,
+ Blink,
+};
- /** @brief Name of the LED and it's proposed action.
- * This structure is supplied as configuration at build time
- */
- struct LedAction
- {
- std::string name;
- Action action;
- uint8_t dutyOn;
- uint16_t period;
- Action priority;
+/** @brief Name of the LED and it's proposed action.
+ * This structure is supplied as configuration at build time
+ */
+struct LedAction
+{
+ std::string name;
+ Action action;
+ uint8_t dutyOn;
+ uint16_t period;
+ Action priority;
- // Order LEDs such that same LEDs are grouped next to
- // each other and the same LEDs are in priority order
- // with the highest priority coming first
- bool operator<(const LedAction& right) const
+ // Order LEDs such that same LEDs are grouped next to
+ // each other and the same LEDs are in priority order
+ // with the highest priority coming first
+ bool operator<(const LedAction& right) const
+ {
+ if (name == right.name)
{
- if (name == right.name)
+ if (action == right.action)
{
- if (action == right.action)
- {
- return false;
- }
- else if (action == priority)
- {
- return true;
- }
+ return false;
}
- return name < right.name;
+ else if (action == priority)
+ {
+ return true;
+ }
}
- };
+ return name < right.name;
+ }
+};
} // namespace Layout
} // namespace led
} // namespace phosphor
diff --git a/manager.cpp b/manager.cpp
index 28e6815..0235b7b 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -1,10 +1,11 @@
-#include <iostream>
-#include <string>
+#include "manager.hpp"
+
#include <algorithm>
+#include <iostream>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
+#include <string>
#include <xyz/openbmc_project/Led/Physical/server.hpp>
-#include "manager.hpp"
namespace phosphor
{
namespace led
@@ -28,41 +29,40 @@
}
// This will contain the union of what's already in the asserted group
- group desiredState {};
- for(const auto& grp : assertedGroups)
+ group desiredState{};
+ for (const auto& grp : assertedGroups)
{
desiredState.insert(grp->cbegin(), grp->cend());
}
// Find difference between Combined and Desired to identify
// which LEDs are getting altered
- group transient {};
+ group transient{};
std::set_difference(combinedState.begin(), combinedState.end(),
desiredState.begin(), desiredState.end(),
- std::inserter(transient, transient.begin()),
- ledComp);
- if(transient.size())
+ std::inserter(transient, transient.begin()), ledComp);
+ if (transient.size())
{
// Find common LEDs between transient and Desired to know if some LEDs
// are changing state and not really getting DeAsserted
- group ledsTransient {};
- std::set_intersection(transient.begin(),transient.end(),
- desiredState.begin(), desiredState.end(),
- std::inserter(ledsTransient, ledsTransient.begin()),
- ledLess);
+ group ledsTransient{};
+ std::set_intersection(
+ transient.begin(), transient.end(), desiredState.begin(),
+ desiredState.end(),
+ std::inserter(ledsTransient, ledsTransient.begin()), ledLess);
// Find difference between above 2 to identify those LEDs which are
// really getting DeAsserted
- std::set_difference(transient.begin(),transient.end(),
- ledsTransient.begin(),ledsTransient.end(),
+ std::set_difference(transient.begin(), transient.end(),
+ ledsTransient.begin(), ledsTransient.end(),
std::inserter(ledsDeAssert, ledsDeAssert.begin()),
ledLess);
// Remove the elements from Current that are being DeAsserted.
- if(ledsDeAssert.size())
+ if (ledsDeAssert.size())
{
// Power off LEDs that are to be really DeAsserted
- for (auto& it:ledsDeAssert)
+ for (auto& it : ledsDeAssert)
{
// Update LEDs in "physically asserted" set by removing those
// LEDs which are De-Asserted
@@ -77,18 +77,16 @@
// Now LEDs that are to be Asserted. These could either be fresh asserts
// -or- change between [On]<-->[Blink]
- group temp {};
+ group temp{};
std::unique_copy(desiredState.begin(), desiredState.end(),
- std::inserter(temp, temp.begin()),
- ledEqual);
- if(temp.size())
+ std::inserter(temp, temp.begin()), ledEqual);
+ if (temp.size())
{
// Find difference between [desired to be Asserted] and those LEDs
// that are physically asserted currently.
- std::set_difference(temp.begin(), temp.end(),
- currentState.begin(), currentState.end(),
- std::inserter(ledsAssert, ledsAssert.begin()),
- ledComp);
+ std::set_difference(
+ temp.begin(), temp.end(), currentState.begin(), currentState.end(),
+ std::inserter(ledsAssert, ledsAssert.begin()), ledComp);
}
// Update the current actual and desired(the virtual actual)
@@ -115,20 +113,22 @@
// This order of LED operation is important.
if (ledsDeAssert.size())
{
- for (const auto& it: ledsDeAssert)
+ for (const auto& it : ledsDeAssert)
{
std::string objPath = std::string(PHY_LED_PATH) + it.name;
- log<level::DEBUG>("De-Asserting LED", entry("NAME=%s", it.name.c_str()));
+ log<level::DEBUG>("De-Asserting LED",
+ entry("NAME=%s", it.name.c_str()));
drivePhysicalLED(objPath, Layout::Action::Off, it.dutyOn);
}
}
- if(ledsAssert.size())
+ if (ledsAssert.size())
{
- for (const auto& it: ledsAssert)
+ for (const auto& it : ledsAssert)
{
std::string objPath = std::string(PHY_LED_PATH) + it.name;
- log<level::DEBUG>("Asserting LED", entry("NAME=%s", it.name.c_str()));
+ log<level::DEBUG>("Asserting LED",
+ entry("NAME=%s", it.name.c_str()));
drivePhysicalLED(objPath, it.action, it.dutyOn);
}
}
@@ -137,8 +137,7 @@
// Calls into driving physical LED post choosing the action
void Manager::drivePhysicalLED(const std::string& objPath,
- Layout::Action action,
- uint8_t dutyOn)
+ Layout::Action action, uint8_t dutyOn)
{
using namespace phosphor::logging;
@@ -146,18 +145,18 @@
if (service == phyLeds.end() || service->second.empty())
{
log<level::ERR>("No service providers for physical LED",
- entry("PATH=%s",objPath.c_str()));
+ entry("PATH=%s", objPath.c_str()));
return;
}
- // If Blink, set its property
- if (action == Layout::Action::Blink)
- {
- drivePhysicalLED(service->second, objPath, "DutyOn", dutyOn);
- }
- drivePhysicalLED(service->second, objPath, "State",
- getPhysicalAction(action));
- return;
+ // If Blink, set its property
+ if (action == Layout::Action::Blink)
+ {
+ drivePhysicalLED(service->second, objPath, "DutyOn", dutyOn);
+ }
+ drivePhysicalLED(service->second, objPath, "State",
+ getPhysicalAction(action));
+ return;
}
/** @brief Returns action string based on enum */
@@ -168,11 +167,11 @@
// TODO: openbmc/phosphor-led-manager#5
// Somehow need to use the generated Action enum than giving one
// in ledlayout.
- if(action == Layout::Action::On)
+ if (action == Layout::Action::On)
{
return server::convertForMessage(server::Physical::Action::On);
}
- else if(action == Layout::Action::Blink)
+ else if (action == Layout::Action::Blink)
{
return server::convertForMessage(server::Physical::Action::Blink);
}
@@ -188,9 +187,9 @@
using namespace phosphor::logging;
// Mapper dbus constructs
- constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
- constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
- constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
+ constexpr auto MAPPER_BUSNAME = "xyz.openbmc_project.ObjectMapper";
+ constexpr auto MAPPER_OBJ_PATH = "/xyz/openbmc_project/object_mapper";
+ constexpr auto MAPPER_IFACE = "xyz.openbmc_project.ObjectMapper";
// Needed to be passed to get the SubTree level
auto depth = 0;
@@ -211,13 +210,13 @@
{
// Its okay if we do not see a corresponding physical LED.
log<level::INFO>("Error looking up Physical LED services",
- entry("PATH=%s",PHY_LED_PATH));
+ entry("PATH=%s", PHY_LED_PATH));
return;
}
// Response by mapper in the case of success
- std::map<std::string, std::map<std::string,
- std::vector<std::string>>> objectTree;
+ std::map<std::string, std::map<std::string, std::vector<std::string>>>
+ objectTree;
// This is the dict of object paths - service names - interfaces
try
@@ -234,7 +233,7 @@
if (objectTree.empty())
{
log<level::INFO>("Physical LED lookup did not return any services",
- entry("PATH=%s",PHY_LED_PATH));
+ entry("PATH=%s", PHY_LED_PATH));
return;
}
diff --git a/manager.hpp b/manager.hpp
index c96a4bc..65f4c83 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -1,10 +1,11 @@
#pragma once
-#include <map>
-#include <set>
-#include <sdbusplus/bus.hpp>
#include "ledlayout.hpp"
+#include <map>
+#include <sdbusplus/bus.hpp>
+#include <set>
+
namespace phosphor
{
namespace led
@@ -20,162 +21,158 @@
*/
class Manager
{
- public:
- /** @brief Only need the default Manager */
- Manager() = delete;
- ~Manager() = default;
- Manager(const Manager&) = delete;
- Manager& operator=(const Manager&) = delete;
- Manager(Manager&&) = delete;
- Manager& operator=(Manager&&) = delete;
+ public:
+ /** @brief Only need the default Manager */
+ Manager() = delete;
+ ~Manager() = default;
+ Manager(const Manager&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(Manager&&) = delete;
- /** @brief Special comparator for finding set difference */
- static bool ledComp(const phosphor::led::Layout::LedAction& left,
- const phosphor::led::Layout::LedAction& right)
+ /** @brief Special comparator for finding set difference */
+ static bool ledComp(const phosphor::led::Layout::LedAction& left,
+ const phosphor::led::Layout::LedAction& right)
+ {
+ // Example :
+ // If FIRST_1 is {fan0, 1, 1} and FIRST_2 is {fan0, 2, 2},
+ // with default priority of Blink, this comparator would return
+ // false. But considering the priority, this comparator would need
+ // to return true so that we consider appropriate set and in
+ // this case its {fan0, 1, 1}
+ if (left.name == right.name)
{
- // Example :
- // If FIRST_1 is {fan0, 1, 1} and FIRST_2 is {fan0, 2, 2},
- // with default priority of Blink, this comparator would return
- // false. But considering the priority, this comparator would need
- // to return true so that we consider appropriate set and in
- // this case its {fan0, 1, 1}
- if (left.name == right.name)
+ if (left.action == right.action)
{
- if (left.action == right.action)
- {
- return false;
- }
- else
- {
- return true;
- }
+ return false;
}
- return left.name < right.name;
+ else
+ {
+ return true;
+ }
}
+ return left.name < right.name;
+ }
- /** @brief Comparator for finding LEDs to be DeAsserted */
- static bool ledLess(const phosphor::led::Layout::LedAction& left,
- const phosphor::led::Layout::LedAction& right)
- {
- return left.name < right.name;
- }
+ /** @brief Comparator for finding LEDs to be DeAsserted */
+ static bool ledLess(const phosphor::led::Layout::LedAction& left,
+ const phosphor::led::Layout::LedAction& right)
+ {
+ return left.name < right.name;
+ }
- /** @brief Comparator for helping unique_copy */
- static bool ledEqual(const phosphor::led::Layout::LedAction& left,
- const phosphor::led::Layout::LedAction& right)
- {
- return left.name == right.name;
- }
+ /** @brief Comparator for helping unique_copy */
+ static bool ledEqual(const phosphor::led::Layout::LedAction& left,
+ const phosphor::led::Layout::LedAction& right)
+ {
+ return left.name == right.name;
+ }
- using group = std::set<phosphor::led::Layout::LedAction>;
- using LedLayout = std::map<std::string, group>;
+ using group = std::set<phosphor::led::Layout::LedAction>;
+ using LedLayout = std::map<std::string, group>;
- /** @brief static global map constructed at compile time */
- const LedLayout& ledMap;
+ /** @brief static global map constructed at compile time */
+ const LedLayout& ledMap;
- /** @brief Refer the user supplied LED layout and sdbusplus handler
- *
- * @param [in] bus - sdbusplus handler
- * @param [in] LedLayout - LEDs group layout
- */
- Manager(sdbusplus::bus::bus& bus,
- const LedLayout& ledLayout)
- : ledMap(ledLayout),
- bus(bus)
- {
- // Nothing here
- }
+ /** @brief Refer the user supplied LED layout and sdbusplus handler
+ *
+ * @param [in] bus - sdbusplus handler
+ * @param [in] LedLayout - LEDs group layout
+ */
+ Manager(sdbusplus::bus::bus& bus, const LedLayout& ledLayout) :
+ ledMap(ledLayout), bus(bus)
+ {
+ // Nothing here
+ }
- /** @brief Given a group name, applies the action on the group
- *
- * @param[in] path - dbus path of group
- * @param[in] assert - Could be true or false
- * @param[in] ledsAssert - LEDs that are to be asserted new
- * or to a different state
- * @param[in] ledsDeAssert - LEDs that are to be Deasserted
- *
- * @return - Success or exception thrown
- */
- bool setGroupState(const std::string& path, bool assert,
- group& ledsAssert, group& ledsDeAssert);
+ /** @brief Given a group name, applies the action on the group
+ *
+ * @param[in] path - dbus path of group
+ * @param[in] assert - Could be true or false
+ * @param[in] ledsAssert - LEDs that are to be asserted new
+ * or to a different state
+ * @param[in] ledsDeAssert - LEDs that are to be Deasserted
+ *
+ * @return - Success or exception thrown
+ */
+ bool setGroupState(const std::string& path, bool assert, group& ledsAssert,
+ group& ledsDeAssert);
- /** @brief Finds the set of LEDs to operate on and executes action
- *
- * @param[in] ledsAssert - LEDs that are to be asserted newly
- * or to a different state
- * @param[in] ledsDeAssert - LEDs that are to be Deasserted
- *
- * @return: None
- */
- void driveLEDs(group& ledsAssert, group& ledsDeAssert);
+ /** @brief Finds the set of LEDs to operate on and executes action
+ *
+ * @param[in] ledsAssert - LEDs that are to be asserted newly
+ * or to a different state
+ * @param[in] ledsDeAssert - LEDs that are to be Deasserted
+ *
+ * @return: None
+ */
+ void driveLEDs(group& ledsAssert, group& ledsDeAssert);
- private:
- /** @brief sdbusplus handler */
- sdbusplus::bus::bus& bus;
+ private:
+ /** @brief sdbusplus handler */
+ sdbusplus::bus::bus& bus;
- /** Map of physical LED path to service name */
- std::map<std::string, std::string> phyLeds {};
+ /** Map of physical LED path to service name */
+ std::map<std::string, std::string> phyLeds{};
- /** @brief Pointers to groups that are in asserted state */
- std::set<const group*> assertedGroups;
+ /** @brief Pointers to groups that are in asserted state */
+ std::set<const group*> assertedGroups;
- /** @brief Contains the highest priority actions for all
- * asserted LEDs.
- */
- group currentState;
+ /** @brief Contains the highest priority actions for all
+ * asserted LEDs.
+ */
+ group currentState;
- /** @brief Contains the set of all actions for asserted LEDs */
- group combinedState;
+ /** @brief Contains the set of all actions for asserted LEDs */
+ group combinedState;
- /** @brief Returns action string based on enum
- *
- * @param[in] action - Action enum
- *
- * @return string equivalent of the passed in enumeration
- */
- static std::string getPhysicalAction(Layout::Action action);
+ /** @brief Returns action string based on enum
+ *
+ * @param[in] action - Action enum
+ *
+ * @return string equivalent of the passed in enumeration
+ */
+ static std::string getPhysicalAction(Layout::Action action);
- /** @brief Chooses appropriate action to be triggered on physical LED
- * and calls into function that applies the actual action.
- *
- * @param[in] objPath - dbus object path
- * @param[in] action - Intended action to be triggered
- * @param[in] dutyOn - Duty Cycle ON percentage
- */
- void drivePhysicalLED(const std::string& objPath,
- Layout::Action action,
- uint8_t dutyOn);
+ /** @brief Chooses appropriate action to be triggered on physical LED
+ * and calls into function that applies the actual action.
+ *
+ * @param[in] objPath - dbus object path
+ * @param[in] action - Intended action to be triggered
+ * @param[in] dutyOn - Duty Cycle ON percentage
+ */
+ void drivePhysicalLED(const std::string& objPath, Layout::Action action,
+ uint8_t dutyOn);
- /** @brief Makes a dbus call to a passed in service name.
- * This is now the physical LED controller
- *
- * @param[in] service - dbus service name
- * @param[in] objPath - dbus object path
- * @param[in] property - property to be written to
- * @param[in] value - Value to write
- */
- template <typename T>
- void drivePhysicalLED(const std::string& service,
- const std::string& objPath,
- const std::string& property,
- const T& value)
- {
- sdbusplus::message::variant<T> data = value;
+ /** @brief Makes a dbus call to a passed in service name.
+ * This is now the physical LED controller
+ *
+ * @param[in] service - dbus service name
+ * @param[in] objPath - dbus object path
+ * @param[in] property - property to be written to
+ * @param[in] value - Value to write
+ */
+ template <typename T>
+ void drivePhysicalLED(const std::string& service,
+ const std::string& objPath,
+ const std::string& property, const T& value)
+ {
+ sdbusplus::message::variant<T> data = value;
- auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
- DBUS_PROPERTY_IFACE, "Set");
- method.append(PHY_LED_IFACE);
- method.append(property);
- method.append(data);
+ auto method = bus.new_method_call(service.c_str(), objPath.c_str(),
+ DBUS_PROPERTY_IFACE, "Set");
+ method.append(PHY_LED_IFACE);
+ method.append(property);
+ method.append(data);
- // There will be exceptions going forward and hence don't need a
- // response
- bus.call_noreply(method);
- return;
- }
+ // There will be exceptions going forward and hence don't need a
+ // response
+ bus.call_noreply(method);
+ return;
+ }
- /** @brief Populates map of Physical LED paths to service name */
- void populateObjectMap();
+ /** @brief Populates map of Physical LED paths to service name */
+ void populateObjectMap();
};
} // namespace led
diff --git a/test/led-test-map.hpp b/test/led-test-map.hpp
index 0b44ee3..f76d00e 100644
--- a/test/led-test-map.hpp
+++ b/test/led-test-map.hpp
@@ -1,240 +1,243 @@
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> singleLedOn = {
- { "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
+#include "ledlayout.hpp"
+
+#include <map>
+#include <set>
+#include <string>
+
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ singleLedOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/SingleLed",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> singleLedBlink = {
- { "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ singleLedBlink = {
+ {"/xyz/openbmc_project/ledmanager/groups/SingleLed",
+ {
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> singleLedBlinkOverrideOn = {
- { "/xyz/openbmc_project/ledmanager/groups/SingleLed",{
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ singleLedBlinkOverrideOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/SingleLed",
+ {
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> multipleLedsOn = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLeds",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ multipleLedsOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLeds",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> multipleLedsBlink = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLeds",{
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink,0,
- 0, phosphor::led::Layout::Blink},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ multipleLedsBlink = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLeds",
+ {
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> multipleLedsOnAndBlink = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix",{
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ multipleLedsOnAndBlink = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix",
+ {
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0,
+ phosphor::led::Layout::Blink},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> twoGroupsWithDistinctLEDsOn = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithDistinctLEDsOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOn = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithOneComonLEDOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOnOneLEDBlinkPriority = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithOneComonLEDOnOneLEDBlinkPriority = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>> twoGroupsWithOneComonLEDOnPriority = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithOneComonLEDOnPriority = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>>
- twoGroupsWithMultiplComonLEDOn = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Seven",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithMultiplComonLEDOn = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Seven", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>>
- twoGroupsWithMultipleComonLEDInDifferentState = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithMultipleComonLEDInDifferentState = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ }},
};
-static const std::map<std::string,
- std::set<phosphor::led::Layout::LedAction>>
- twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority = {
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",{
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
- { "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",{
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- }
- },
+static const std::map<std::string, std::set<phosphor::led::Layout::LedAction>>
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority = {
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet",
+ {
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
+ {"/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet",
+ {
+ {"Two", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ }},
};
diff --git a/test/utest.cpp b/test/utest.cpp
index 455179c..18a4341 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -1,22 +1,24 @@
-#include <set>
-#include <algorithm>
-#include <gtest/gtest.h>
-#include <sdbusplus/bus.hpp>
-#include "manager.hpp"
#include "led-test-map.hpp"
+#include "manager.hpp"
+
+#include <algorithm>
+#include <sdbusplus/bus.hpp>
+#include <set>
+
+#include <gtest/gtest.h>
using namespace phosphor::led;
class LedTest : public ::testing::Test
{
- public:
- sdbusplus::bus::bus bus;
- LedTest() : bus(sdbusplus::bus::new_default())
- {
- // Nothing here
- }
- ~LedTest()
- {
- // Leaving up to auto cleanup.
- }
+ public:
+ sdbusplus::bus::bus bus;
+ LedTest() : bus(sdbusplus::bus::new_default())
+ {
+ // Nothing here
+ }
+ ~LedTest()
+ {
+ // Leaving up to auto cleanup.
+ }
};
/** @brief Assert Single LED to On */
@@ -25,24 +27,24 @@
Manager manager(bus, singleLedOn);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -56,24 +58,24 @@
Manager manager(bus, singleLedBlink);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -87,24 +89,24 @@
Manager manager(bus, singleLedOn);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -112,12 +114,12 @@
}
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/SingleLed";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
EXPECT_EQ(0, ledsAssert.size());
@@ -131,28 +133,26 @@
Manager manager(bus, multipleLedsOn);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -166,28 +166,28 @@
Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -201,28 +201,28 @@
Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -230,28 +230,28 @@
}
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -265,28 +265,28 @@
Manager manager(bus, multipleLedsBlink);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -294,28 +294,28 @@
}
{
// DeAssert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -323,12 +323,12 @@
}
{
// DeAssert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLeds";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
EXPECT_EQ(0, ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
@@ -341,32 +341,31 @@
Manager manager(bus, multipleLedsOnAndBlink);
{
// Assert the LEDs.
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsMix";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
- {"Three",phosphor::led::Layout::Blink,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::Blink, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -380,28 +379,27 @@
Manager manager(bus, twoGroupsWithDistinctLEDsOn);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -409,28 +407,27 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -444,28 +441,26 @@
Manager manager(bus, twoGroupsWithOneComonLEDOn);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -473,26 +468,25 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -507,28 +501,26 @@
Manager manager(bus, twoGroupsWithOneComonLEDOnOneLEDBlinkPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -536,27 +528,26 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// Does not action on [Three] since priority is [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -564,27 +555,26 @@
}
{
// De-Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
// [Three] is not touched since its already [Blink]
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -599,28 +589,26 @@
Manager manager(bus, twoGroupsWithOneComonLEDOnOneLEDBlinkPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -628,27 +616,26 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// [Three] does not get actioned since it has Blink priority
std::set<Layout::LedAction> refAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -656,25 +643,23 @@
}
{
// De-Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -682,13 +667,13 @@
// Need just the ledsAssert populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp1 {};
+ Manager::group temp1{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp1, temp1.begin()));
@@ -703,28 +688,26 @@
Manager manager(bus, twoGroupsWithOneComonLEDOnPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true,
- ledsAssert, ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -732,56 +715,53 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// Three is set to ON due to ON priority.
std::set<Layout::LedAction> refAssert = {
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
}
{
// De-Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAssserted populated with these.
// [Three] stays in [On] since [B] has it [On]
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -796,28 +776,26 @@
Manager manager(bus, twoGroupsWithOneComonLEDOnPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -825,54 +803,52 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// Three is set to ON due to ON priority.
std::set<Layout::LedAction> refAssert = {
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
}
{
// De-Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -881,13 +857,13 @@
// Need just the ledsAssert populated with these.
// Since [Three] stood [On], need to go back to [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp1 {};
+ Manager::group temp1{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -901,30 +877,28 @@
Manager manager(bus, twoGroupsWithMultiplComonLEDOn);
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Seven",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Seven", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -932,24 +906,23 @@
}
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -957,31 +930,29 @@
}
{
// De-Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Seven",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Seven", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
EXPECT_EQ(0, temp.size());
-
}
}
@@ -991,30 +962,28 @@
Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1022,28 +991,27 @@
}
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these
// [Two] remains [On] due to higher priority.
// [Three] remains [Blink]
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1057,31 +1025,30 @@
Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.'Two' gets to Blink
// due to higher priority.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1089,30 +1056,28 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// [Three] remains [Blink] from previous
// [Two] moves to [On] from [Blink] due to [On] priority
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1123,35 +1088,35 @@
/** @brief Assert 2 groups having multiple LEDs common in different state
* DeAssert twice
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateAtoBDeAssertTwice)
+TEST_F(LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateAtoBDeAssertTwice)
{
Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentState);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1159,30 +1124,28 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
// [Two] turns [On] due to priority
// [Three] remains [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1190,25 +1153,24 @@
}
{
// DeAssert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1217,13 +1179,13 @@
// Need just the ledsAssert populated with these.
// [Two] will go back to [Blink] from [On]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp1 {};
+ Manager::group temp1{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp1, temp1.begin()));
@@ -1231,30 +1193,29 @@
}
{
// DeAssert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1262,12 +1223,12 @@
}
{
// DeAssert Set-A again and make sure we get all empty
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
EXPECT_EQ(0, ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
@@ -1277,37 +1238,38 @@
/** @brief Assert 2 groups having multiple LEDs common in different state and
* mixed priority. DeAssert-A
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandB)
+TEST_F(LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandB)
{
- Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+ Manager manager(bus,
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1315,12 +1277,12 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
@@ -1328,18 +1290,16 @@
// [Three] remains on since it never was in [Blink] before
// [Ten] remains [Blink] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1347,20 +1307,19 @@
}
{
// De-Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAsssert populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
@@ -1369,13 +1328,13 @@
// [Three] remains [On] since it never changed state.
// [Two] remains [On] since it did not go back
std::set<Layout::LedAction> refAssert = {
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1386,37 +1345,39 @@
/** @brief Assert 2 groups having multiple LEDs common in different state and
* mixed priority. DeAssert-B
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandBDeAssertB)
+TEST_F(
+ LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityAandBDeAssertB)
{
- Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+ Manager manager(bus,
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1424,12 +1385,12 @@
}
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
@@ -1437,18 +1398,16 @@
// [Three] remains on since it never was in [Blink] before
// [Ten] remains [Blink] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1456,20 +1415,19 @@
}
{
// De-Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsDeAsssert populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
@@ -1478,13 +1436,13 @@
// [Three] remains [On] since it never changed state.
// [Two] moves to [Blink] since there is no prior [On]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1495,37 +1453,37 @@
/** @brief Assert 2 groups having multiple LEDs common in different state and
* mixed priority.
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandA)
+TEST_F(LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandA)
{
- Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+ Manager manager(bus,
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1533,12 +1491,12 @@
}
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
@@ -1546,18 +1504,17 @@
// [Three] remains on since it never was in [Blink] before
// [Ten] moves to [Blink] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1568,37 +1525,38 @@
/** @brief Assert 2 groups having multiple LEDs common in different state and
* mixed priority and De-Assert-A
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandADeAssertA)
+TEST_F(
+ LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateDiffPriorityBandADeAssertA)
{
- Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+ Manager manager(bus,
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1606,12 +1564,12 @@
}
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
@@ -1619,18 +1577,17 @@
// [Three] remains on since it never was in [Blink] before
// [Ten] moves to [Blink] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1638,21 +1595,20 @@
}
{
// De-Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
// [Ten] remains [Blink] due to priority.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
@@ -1661,13 +1617,13 @@
// [Three] remains [On] since it never was in [Blink] before
// [Ten] moves to [On] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1678,37 +1634,37 @@
/** @brief Assert 2 groups having multiple LEDs common in different state and
* mixed priority and then DeAssert twice.
*/
-TEST_F(LedTest, assertTwoGroupsWithMultipleComonLEDInDifferentStateOnBlinkPriorityBandA)
+TEST_F(LedTest,
+ assertTwoGroupsWithMultipleComonLEDInDifferentStateOnBlinkPriorityBandA)
{
- Manager manager(bus, twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
+ Manager manager(bus,
+ twoGroupsWithMultipleComonLEDInDifferentStateDiffPriority);
{
// Assert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
+ {"Two", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1716,12 +1672,12 @@
}
{
// Assert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, true, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, true, ledsAssert, ledsDeAssert);
EXPECT_EQ(true, result);
// Need just the ledsAssserted populated with these.
@@ -1729,18 +1685,17 @@
// [Three] remains on since it never was in [Blink] before
// [Ten] moves to [Blink] due to priority: [Blink]
std::set<Layout::LedAction> refAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
EXPECT_EQ(0, ledsDeAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1748,26 +1703,25 @@
}
{
// DeAssert Set-B
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
// [Ten] remains [Blink] due to priority.
std::set<Layout::LedAction> refDeAssert = {
- {"Five",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Six",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
+ {"Five", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Six", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1776,13 +1730,13 @@
// Need just the ledsAssert populated with these.
// [Two] will move to [Blink]
std::set<Layout::LedAction> refAssert = {
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
};
EXPECT_EQ(refAssert.size(), ledsAssert.size());
// difference of refAssert and ledsAssert must be null.
- Manager::group temp1 {};
+ Manager::group temp1{};
std::set_difference(ledsAssert.begin(), ledsAssert.end(),
refAssert.begin(), refAssert.end(),
std::inserter(temp1, temp1.begin()));
@@ -1790,32 +1744,31 @@
}
{
// DeAssert Set-A
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsASet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
// Need just the ledsAssserted populated with these.
std::set<Layout::LedAction> refDeAssert = {
- {"One",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Two",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::On},
- {"Three",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::Blink},
- {"Four",phosphor::led::Layout::On, 0,
- 0, phosphor::led::Layout::On},
- {"Ten",phosphor::led::Layout::Blink, 0,
- 0, phosphor::led::Layout::Blink},
+ {"One", phosphor::led::Layout::On, 0, 0, phosphor::led::Layout::On},
+ {"Two", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::On},
+ {"Three", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::Blink},
+ {"Four", phosphor::led::Layout::On, 0, 0,
+ phosphor::led::Layout::On},
+ {"Ten", phosphor::led::Layout::Blink, 0, 0,
+ phosphor::led::Layout::Blink},
};
EXPECT_EQ(refDeAssert.size(), ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());
// difference of refDeAssert and ledsDeAssert must be null.
- Manager::group temp {};
+ Manager::group temp{};
std::set_difference(ledsDeAssert.begin(), ledsDeAssert.end(),
refDeAssert.begin(), refDeAssert.end(),
std::inserter(temp, temp.begin()));
@@ -1823,12 +1776,12 @@
}
{
// DeAssert Set-B again and make sure we get all empty
- Manager::group ledsAssert {};
- Manager::group ledsDeAssert {};
+ Manager::group ledsAssert{};
+ Manager::group ledsDeAssert{};
- auto group ="/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
- auto result = manager.setGroupState(group, false, ledsAssert,
- ledsDeAssert);
+ auto group = "/xyz/openbmc_project/ledmanager/groups/MultipleLedsBSet";
+ auto result =
+ manager.setGroupState(group, false, ledsAssert, ledsDeAssert);
EXPECT_EQ(false, result);
EXPECT_EQ(0, ledsDeAssert.size());
EXPECT_EQ(0, ledsAssert.size());