blob: 309333a47aa9f8ffda3e58aed6779a5115f58a9d [file] [log] [blame]
Patrick Venturefdc65b22018-08-07 14:37:58 -07001#include "ipmi.hpp"
Patrick Venturefdc65b22018-08-07 14:37:58 -07002#include "updater_mock.hpp"
3
4#include <gtest/gtest.h>
5
6using ::testing::Return;
7using ::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
13TEST(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}