Patrick Venture | 16ab2a1 | 2019-05-31 08:52:51 -0700 | [diff] [blame] | 1 | /* The goal of these tests is to verify the behavior of all blob commands given |
| 2 | * the current state is updateStarted. This state is achieved as an exit from |
| 3 | * updatePending. |
| 4 | */ |
| 5 | #include "firmware_handler.hpp" |
| 6 | #include "firmware_unittest.hpp" |
| 7 | #include "status.hpp" |
| 8 | #include "util.hpp" |
| 9 | |
| 10 | #include <cstdint> |
| 11 | #include <string> |
| 12 | #include <vector> |
| 13 | |
| 14 | #include <gtest/gtest.h> |
| 15 | |
| 16 | namespace ipmi_flash |
| 17 | { |
| 18 | namespace |
| 19 | { |
| 20 | |
| 21 | using ::testing::Return; |
| 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 FirmwareHandlerUpdateStartedTest : public IpmiOnlyFirmwareStaticTest |
| 39 | { |
| 40 | }; |
| 41 | |
Patrick Venture | f515b9c | 2019-05-31 10:38:16 -0700 | [diff] [blame^] | 42 | /* |
| 43 | * open(blob) |
| 44 | */ |
| 45 | TEST_F(FirmwareHandlerUpdateStartedTest, AttemptToOpenFilesReturnsFailure) |
| 46 | { |
| 47 | /* In state updateStarted a file is open, which means no others can be. */ |
| 48 | getToUpdateStarted(); |
| 49 | |
| 50 | auto blobsToOpen = handler->getBlobIds(); |
| 51 | for (const auto& blob : blobsToOpen) |
| 52 | { |
| 53 | EXPECT_FALSE(handler->open(session + 1, flags, blob)); |
| 54 | } |
| 55 | } |
| 56 | |
Patrick Venture | 16ab2a1 | 2019-05-31 08:52:51 -0700 | [diff] [blame] | 57 | /* canHandleBlob(blob) |
| 58 | * getBlobIds |
| 59 | */ |
| 60 | |
| 61 | /* |
| 62 | * TODO: deleteBlob(blob) |
| 63 | */ |
| 64 | |
| 65 | /* |
| 66 | * stat(blob) |
| 67 | */ |
| 68 | |
| 69 | /* |
| 70 | * stat(session) |
| 71 | */ |
Patrick Venture | 16ab2a1 | 2019-05-31 08:52:51 -0700 | [diff] [blame] | 72 | |
| 73 | /* |
| 74 | * close(session) |
| 75 | */ |
| 76 | |
| 77 | /* |
| 78 | * writemeta(session) |
| 79 | */ |
| 80 | |
| 81 | /* |
| 82 | * write(session) |
| 83 | */ |
| 84 | |
| 85 | /* |
| 86 | * read(session) |
| 87 | */ |
| 88 | |
| 89 | /* |
| 90 | * commit(session) |
| 91 | */ |
| 92 | |
| 93 | } // namespace |
| 94 | } // namespace ipmi_flash |