diff options
author | Patrick Venture <venture@google.com> | 2019-05-14 13:29:10 -0700 |
---|---|---|
committer | Patrick Venture <venture@google.com> | 2019-05-14 13:42:05 -0700 |
commit | 8865e40b6e54384fc3c9911d15d6261b414a3d91 (patch) | |
tree | b82fb451998bcf64f547431088494414e3bd58cd /test/tools_blob_unittest.cpp | |
parent | 22fcc84469975fe5ca3597f78fe8103e8a8bbc52 (diff) | |
download | ipmi-blob-tool-8865e40b6e54384fc3c9911d15d6261b414a3d91.tar.gz ipmi-blob-tool-8865e40b6e54384fc3c9911d15d6261b414a3d91.zip |
blob: implement commit command
Implement the commit command for the blob handler.
Change-Id: Ia3be86083991cbdf7fe85c15986f4e1cb60971f5
Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'test/tools_blob_unittest.cpp')
-rw-r--r-- | test/tools_blob_unittest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/tools_blob_unittest.cpp b/test/tools_blob_unittest.cpp index 75e43cb..e9f2c96 100644 --- a/test/tools_blob_unittest.cpp +++ b/test/tools_blob_unittest.cpp @@ -295,6 +295,28 @@ TEST_F(BlobHandlerTest, closeBlobSucceeds) blob.closeBlob(0x0001); } +TEST_F(BlobHandlerTest, commitSucceedsNoData) +{ + /* The commit succeeds. */ + auto ipmi = CreateIpmiMock(); + IpmiInterfaceMock* ipmiMock = + reinterpret_cast<IpmiInterfaceMock*>(ipmi.get()); + BlobHandler blob(std::move(ipmi)); + + std::vector<std::uint8_t> request = { + 0xcf, 0xc2, 0x00, BlobHandler::BlobOEMCommands::bmcBlobCommit, + 0x00, 0x00, 0x01, 0x00, + 0x00}; + + std::vector<std::uint8_t> resp = {0xcf, 0xc2, 0x00}; + std::vector<std::uint8_t> reqCrc = {0x01, 0x00, 0x00}; + EXPECT_CALL(crcMock, generateCrc(Eq(reqCrc))).WillOnce(Return(0x00)); + + EXPECT_CALL(*ipmiMock, sendPacket(Eq(request))).WillOnce(Return(resp)); + + blob.commit(0x0001, {}); +} + TEST_F(BlobHandlerTest, writeBytesSucceeds) { /* The write bytes succeeds. */ |