tools: ipmi handler must open ipmi device
The ipmi handler must open the ipmi device on the host.
Note: The initial implementation will only support ipmi system devices
that are listed as device 0. This can be improved later or swapped
out to link against another ipmi command implementation.
Change-Id: I262039fdf3554ba144be1943875fd088766f3b57
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/tools_ipmi_unittest.cpp b/test/tools_ipmi_unittest.cpp
new file mode 100644
index 0000000..8a72489
--- /dev/null
+++ b/test/tools_ipmi_unittest.cpp
@@ -0,0 +1,20 @@
+#include "internal_sys_mock.hpp"
+#include "ipmi_handler.hpp"
+
+namespace host_tool
+{
+
+using ::testing::_;
+using ::testing::Return;
+
+TEST(IpmiHandlerTest, OpenAllFails)
+{
+ /* Open against all device files fail. */
+ internal::InternalSysMock sysMock;
+ IpmiHandler ipmi(&sysMock);
+
+ EXPECT_CALL(sysMock, open(_, _)).WillRepeatedly(Return(-1));
+ EXPECT_EQ(false, ipmi.open());
+}
+
+} // namespace host_tool