initial commit

Add initial code from phosphor-ipmi-flash/tools that was not specific to
firmware update over ipmi-blobs.

Change-Id: I360537a7392347fe989397a699f6a712bc36e62c
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..9516d46
--- /dev/null
+++ b/test/tools_ipmi_unittest.cpp
@@ -0,0 +1,22 @@
+#include "internal_sys_mock.hpp"
+
+#include <ipmiblob/ipmi_errors.hpp>
+#include <ipmiblob/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_THROW(ipmi.open(), IpmiException);
+}
+
+} // namespace host_tool