for injection, add handler: add unit-tests
Add a handler to enable dependency injection for testing. This is a
required step to use mocks.
Add the unit-tests.
Tested: Verified the new unit-tests ran.
Change-Id: I991849e6df2c3e74f59145a966048fc6825560db
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/main.cpp b/main.cpp
index 59fd9f9..9020809 100644
--- a/main.cpp
+++ b/main.cpp
@@ -23,6 +23,18 @@
#include <ipmid/oemopenbmc.hpp>
#include <ipmid/oemrouter.hpp>
+namespace ethstats
+{
+
+static ipmi_ret_t ethStatCommand(ipmi_cmd_t cmd __attribute__((unused)),
+ const uint8_t* reqBuf, uint8_t* replyCmdBuf,
+ size_t* dataLen)
+{
+ return handleEthStatCommand(reqBuf, replyCmdBuf, dataLen);
+}
+
+} // namespace ethstats
+
void setupGlobalOemEthStats() __attribute__((constructor));
void setupGlobalOemEthStats()
@@ -36,7 +48,7 @@
oem::googOemNumber, oem::Cmd::ethStatsCmd);
oemRouter->registerHandler(oem::googOemNumber, oem::Cmd::ethStatsCmd,
- ethstats::handleEthStatCommand);
+ ethstats::ethStatCommand);
#endif
std::fprintf(stderr,
@@ -44,5 +56,5 @@
oem::obmcOemNumber, oem::Cmd::ethStatsCmd);
oemRouter->registerHandler(oem::obmcOemNumber, oem::Cmd::ethStatsCmd,
- ethstats::handleEthStatCommand);
+ ethstats::ethStatCommand);
}