Patrick Venture | fdc65b2 | 2018-08-07 14:37:58 -0700 | [diff] [blame] | 1 | #include "ipmi.hpp" |
Patrick Venture | fdc65b2 | 2018-08-07 14:37:58 -0700 | [diff] [blame] | 2 | #include "updater_mock.hpp" |
| 3 | |
| 4 | #include <gtest/gtest.h> |
| 5 | |
| 6 | using ::testing::Return; |
| 7 | using ::testing::StrictMock; |
| 8 | |
| 9 | // ipmid.hpp isn't installed where we can grab it and this value is per BMC |
| 10 | // SoC. |
| 11 | #define MAX_IPMI_BUFFER 64 |
| 12 | |
| 13 | TEST(IpmiCheckVerifyTest, CallPassedOn) |
| 14 | { |
| 15 | // This IPMI handler just bundles the response. |
| 16 | |
| 17 | StrictMock<UpdaterMock> updater; |
| 18 | |
| 19 | size_t dataLen; |
| 20 | uint8_t request[MAX_IPMI_BUFFER] = {0}; |
| 21 | uint8_t reply[MAX_IPMI_BUFFER] = {0}; |
| 22 | |
| 23 | dataLen = 1; // request is only the command. |
| 24 | request[0] = FlashSubCmds::flashVerifyCheck; |
| 25 | |
| 26 | EXPECT_CALL(updater, checkVerify()) |
| 27 | .WillOnce(Return(VerifyCheckResponse::running)); |
| 28 | EXPECT_EQ(IPMI_CC_OK, checkVerify(&updater, request, reply, &dataLen)); |
| 29 | EXPECT_EQ(sizeof(uint8_t), dataLen); |
| 30 | EXPECT_EQ(VerifyCheckResponse::running, reply[0]); |
| 31 | } |