ipmi: start implementing flashVerifyCheck
Change-Id: I811693d9e736d273d2df9e65f7c5de7efd1d884c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/ipmi_verifycheck_unittest.cpp b/test/ipmi_verifycheck_unittest.cpp
new file mode 100644
index 0000000..f71155f
--- /dev/null
+++ b/test/ipmi_verifycheck_unittest.cpp
@@ -0,0 +1,32 @@
+#include "ipmi.hpp"
+
+#include "updater_mock.hpp"
+
+#include <gtest/gtest.h>
+
+using ::testing::Return;
+using ::testing::StrictMock;
+
+// ipmid.hpp isn't installed where we can grab it and this value is per BMC
+// SoC.
+#define MAX_IPMI_BUFFER 64
+
+TEST(IpmiCheckVerifyTest, CallPassedOn)
+{
+ // This IPMI handler just bundles the response.
+
+ StrictMock<UpdaterMock> updater;
+
+ size_t dataLen;
+ uint8_t request[MAX_IPMI_BUFFER] = {0};
+ uint8_t reply[MAX_IPMI_BUFFER] = {0};
+
+ dataLen = 1; // request is only the command.
+ request[0] = FlashSubCmds::flashVerifyCheck;
+
+ EXPECT_CALL(updater, checkVerify())
+ .WillOnce(Return(VerifyCheckResponse::running));
+ EXPECT_EQ(IPMI_CC_OK, checkVerify(&updater, request, reply, &dataLen));
+ EXPECT_EQ(sizeof(uint8_t), dataLen);
+ EXPECT_EQ(VerifyCheckResponse::running, reply[0]);
+}