blob: 9c334ec8bbc0a84e56c20833a10f5e2e2176f13c [file] [log] [blame]
Patrick Venture5c251ca2018-08-03 18:31:01 -07001#include "flash-ipmi.hpp"
2#include "ipmi.hpp"
Patrick Venture5c251ca2018-08-03 18:31:01 -07003#include "updater_mock.hpp"
4
5#include <gtest/gtest.h>
6
7using ::testing::Return;
8using ::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
14TEST(IpmiAbortTest, CallPassedOn)
15{
16 // The abort call is another pass-through command.
17
18 StrictMock<UpdaterMock> updater;
19
20 size_t dataLen;
21 uint8_t request[MAX_IPMI_BUFFER] = {0};
22 uint8_t reply[MAX_IPMI_BUFFER] = {0};
23
24 dataLen = 1; // request is only the command.
25 request[0] = FlashSubCmds::flashAbort;
26
27 EXPECT_CALL(updater, abortUpdate()).WillOnce(Return(true));
28 EXPECT_EQ(IPMI_CC_OK, abortUpdate(&updater, request, reply, &dataLen));
29 EXPECT_EQ(sizeof(uint8_t), dataLen);
30 EXPECT_EQ(0, reply[0]);
31}