blob: 87e818d707995a7f36b35077ea1a62d4d7e36a4e [file] [log] [blame]
#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(IpmiStartDataVerifyTest, CallPassedOn)
{
// The IPMI handler in this case just passes on the call and returns the
// result without any extra validation.
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::flashDataVerify;
EXPECT_CALL(updater, startDataVerification()).WillOnce(Return(true));
EXPECT_EQ(IPMI_CC_OK, dataVerify(&updater, request, reply, &dataLen));
EXPECT_EQ(sizeof(uint8_t), dataLen);
EXPECT_EQ(0, reply[0]);
}