Patrick Venture | 2098ff9 | 2019-06-03 10:18:05 -0700 | [diff] [blame] | 1 | /* The goal of these tests is to verify the behavior of all blob commands given |
| 2 | * the current state is UpdateCompleted. This state is achieved as an exit from |
| 3 | * updateStarted. |
| 4 | * |
| 5 | * This can be reached with success or failure from an update, and is reached |
| 6 | * via a stat() call from updatedStarted. |
| 7 | */ |
Patrick Venture | ab1e962 | 2019-06-03 10:45:06 -0700 | [diff] [blame^] | 8 | #include "firmware_handler.hpp" |
| 9 | #include "firmware_unittest.hpp" |
| 10 | #include "status.hpp" |
| 11 | #include "util.hpp" |
| 12 | |
| 13 | #include <string> |
| 14 | #include <vector> |
| 15 | |
| 16 | #include <gtest/gtest.h> |
| 17 | |
| 18 | namespace ipmi_flash |
| 19 | { |
| 20 | namespace |
| 21 | { |
| 22 | |
| 23 | /* |
| 24 | * There are the following calls (parameters may vary): |
| 25 | * canHandleBlob(blob) |
| 26 | * getBlobIds |
| 27 | * deleteBlob(blob) |
| 28 | * stat(blob) |
| 29 | * stat(session) |
| 30 | * open(blob) |
| 31 | * close(session) |
| 32 | * writemeta(session) |
| 33 | * write(session) |
| 34 | * read(session) |
| 35 | * commit(session) |
| 36 | */ |
| 37 | |
| 38 | class FirmwareHandlerUpdateCompletedTest : public IpmiOnlyFirmwareStaticTest |
| 39 | { |
| 40 | }; |
| 41 | |
| 42 | /* |
| 43 | * open(blob) |
| 44 | */ |
| 45 | TEST_F(FirmwareHandlerUpdateCompletedTest, |
| 46 | AttemptToOpenFilesReturnsFailureAfterSuccess) |
| 47 | { |
| 48 | /* In state updateCompleted a file is open, which means no others can be. */ |
| 49 | getToUpdateCompleted(UpdateStatus::success); |
| 50 | |
| 51 | auto blobsToOpen = handler->getBlobIds(); |
| 52 | for (const auto& blob : blobsToOpen) |
| 53 | { |
| 54 | EXPECT_FALSE(handler->open(session + 1, flags, blob)); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /* |
| 59 | * There are the following calls (parameters may vary): |
| 60 | * canHandleBlob(blob) |
| 61 | * getBlobIds |
| 62 | * deleteBlob(blob) |
| 63 | * stat(blob) |
| 64 | * stat(session) |
| 65 | * close(session) |
| 66 | * writemeta(session) |
| 67 | * write(session) |
| 68 | * read(session) |
| 69 | * commit(session) |
| 70 | */ |
| 71 | |
| 72 | } // namespace |
| 73 | } // namespace ipmi_flash |