Patrick Venture | 1cb87d2 | 2018-08-03 18:22:09 -0700 | [diff] [blame] | 1 | #include "ipmi.hpp" |
| 2 | |
| 3 | #include "updater_mock.hpp" |
| 4 | |
| 5 | #include <gtest/gtest.h> |
| 6 | |
| 7 | using ::testing::Return; |
| 8 | using ::testing::StrictMock; |
| 9 | |
| 10 | // ipmid.hpp isn't installed where we can grab it and this value is per BMC |
| 11 | // SoC. |
| 12 | #define MAX_IPMI_BUFFER 64 |
| 13 | |
| 14 | TEST(IpmiStartDataVerifyTest, CallPassedOn) |
| 15 | { |
| 16 | // The IPMI handler in this case just passes on the call and returns the |
| 17 | // result without any extra validation. |
| 18 | |
| 19 | StrictMock<UpdaterMock> updater; |
| 20 | |
| 21 | size_t dataLen; |
| 22 | uint8_t request[MAX_IPMI_BUFFER] = {0}; |
| 23 | uint8_t reply[MAX_IPMI_BUFFER] = {0}; |
| 24 | |
| 25 | dataLen = 1; // request is only the command. |
| 26 | request[0] = FlashSubCmds::flashDataVerify; |
| 27 | |
| 28 | EXPECT_CALL(updater, startDataVerification()).WillOnce(Return(true)); |
| 29 | EXPECT_EQ(IPMI_CC_OK, dataVerify(&updater, request, reply, &dataLen)); |
| 30 | EXPECT_EQ(sizeof(uint8_t), dataLen); |
| 31 | EXPECT_EQ(0, reply[0]); |
| 32 | } |