bmc: allowing packing transport flags densely
Future transport backends can densely fill in the upper 5 bits of the
transport flag bitfield.
Signed-off-by: Benjamin Fair <benjaminfair@google.com>
Change-Id: Ie4ee59e0581e458a9020775e18270100f9a1de4e
diff --git a/bmc/test/firmware_stat_unittest.cpp b/bmc/test/firmware_stat_unittest.cpp
index 6e97cc8..4eb2e99 100644
--- a/bmc/test/firmware_stat_unittest.cpp
+++ b/bmc/test/firmware_stat_unittest.cpp
@@ -14,7 +14,9 @@
namespace
{
-TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsTransport)
+/* This test ensures the stat() method preserves compatibility with older host
+ * tools by reporting that all transports are supported. */
+TEST(FirmwareHandlerStatTest, StatOnInactiveBlobIDReturnsAllTransports)
{
/* Test that the metadata information returned matches expectations for this
* case.
@@ -38,7 +40,8 @@
blobs::BlobMeta meta;
EXPECT_TRUE(handler->stat("asdf", &meta));
- EXPECT_EQ(FirmwareFlags::UpdateFlags::ipmi, meta.blobState);
+ /* All transport flags are set */
+ EXPECT_EQ(0xff00, meta.blobState);
}
} // namespace
diff --git a/bmc/test/firmware_state_notyetstarted_unittest.cpp b/bmc/test/firmware_state_notyetstarted_unittest.cpp
index 8aa811f..2a100bd 100644
--- a/bmc/test/firmware_state_notyetstarted_unittest.cpp
+++ b/bmc/test/firmware_state_notyetstarted_unittest.cpp
@@ -73,18 +73,15 @@
TEST_F(FirmwareHandlerNotYetStartedTest, StatEachBlobIdVerifyResults)
{
/* In this original state, calling stat() on the blob ids will return the
- * transported supported.
+ * idle status
*/
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
auto blobs = handler->getBlobIds();
for (const auto& blob : blobs)
{
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_updatecompleted_unittest.cpp b/bmc/test/firmware_state_updatecompleted_unittest.cpp
index fd7f583..320d09e 100644
--- a/bmc/test/firmware_state_updatecompleted_unittest.cpp
+++ b/bmc/test/firmware_state_updatecompleted_unittest.cpp
@@ -122,10 +122,6 @@
{
getToUpdateCompleted(ActionStatus::success);
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
for (const auto& blob : testBlobs)
{
@@ -133,7 +129,7 @@
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_updatepending_unittest.cpp b/bmc/test/firmware_state_updatepending_unittest.cpp
index 6f5162f..d757b3c 100644
--- a/bmc/test/firmware_state_updatepending_unittest.cpp
+++ b/bmc/test/firmware_state_updatepending_unittest.cpp
@@ -163,17 +163,13 @@
{
getToUpdatePending();
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
for (const auto& blob : startingBlobs)
{
ASSERT_TRUE(handler->canHandleBlob(blob));
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_updatestarted_unittest.cpp b/bmc/test/firmware_state_updatestarted_unittest.cpp
index 2e4f020..086dcfa 100644
--- a/bmc/test/firmware_state_updatestarted_unittest.cpp
+++ b/bmc/test/firmware_state_updatestarted_unittest.cpp
@@ -113,10 +113,6 @@
{
getToUpdateStarted();
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
for (const auto& blob : testBlobs)
{
@@ -124,7 +120,7 @@
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_uploadinprogress_unittest.cpp b/bmc/test/firmware_state_uploadinprogress_unittest.cpp
index 72da8bb..366435b 100644
--- a/bmc/test/firmware_state_uploadinprogress_unittest.cpp
+++ b/bmc/test/firmware_state_uploadinprogress_unittest.cpp
@@ -95,10 +95,6 @@
/* Calling stat() on the normal blobs (not the active) ones will work and
* return the same information as in the notYetStarted state.
*/
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
openToInProgress(staticLayoutBlobId);
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
@@ -106,7 +102,7 @@
{
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_verificationcompleted_unittest.cpp b/bmc/test/firmware_state_verificationcompleted_unittest.cpp
index 85f1895..0c6bae7 100644
--- a/bmc/test/firmware_state_verificationcompleted_unittest.cpp
+++ b/bmc/test/firmware_state_verificationcompleted_unittest.cpp
@@ -141,10 +141,6 @@
{
getToVerificationCompleted(ActionStatus::success);
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
for (const auto& blob : testBlobs)
{
@@ -152,7 +148,7 @@
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_verificationpending_unittest.cpp b/bmc/test/firmware_state_verificationpending_unittest.cpp
index 92d5c6b..c9b8e92 100644
--- a/bmc/test/firmware_state_verificationpending_unittest.cpp
+++ b/bmc/test/firmware_state_verificationpending_unittest.cpp
@@ -174,17 +174,13 @@
{
getToVerificationPending(staticLayoutBlobId);
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
for (const auto& blob : testBlobs)
{
ASSERT_TRUE(handler->canHandleBlob(blob));
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_state_verificationstarted_unittest.cpp b/bmc/test/firmware_state_verificationstarted_unittest.cpp
index 8c0d476..a974c2b 100644
--- a/bmc/test/firmware_state_verificationstarted_unittest.cpp
+++ b/bmc/test/firmware_state_verificationstarted_unittest.cpp
@@ -194,10 +194,6 @@
{
getToVerificationStarted(staticLayoutBlobId);
- blobs::BlobMeta expected;
- expected.blobState = FirmwareFlags::UpdateFlags::ipmi;
- expected.size = 0;
-
std::vector<std::string> testBlobs = {staticLayoutBlobId, hashBlobId};
for (const auto& blob : testBlobs)
{
@@ -205,7 +201,7 @@
blobs::BlobMeta meta = {};
EXPECT_TRUE(handler->stat(blob, &meta));
- EXPECT_EQ(expected, meta);
+ EXPECT_EQ(expectedIdleMeta, meta);
}
}
diff --git a/bmc/test/firmware_unittest.hpp b/bmc/test/firmware_unittest.hpp
index 6bf515d..3d7fa4e 100644
--- a/bmc/test/firmware_unittest.hpp
+++ b/bmc/test/firmware_unittest.hpp
@@ -187,6 +187,8 @@
std::uint16_t flags =
blobs::OpenFlags::write | FirmwareFlags::UpdateFlags::ipmi;
+ blobs::BlobMeta expectedIdleMeta = {0xff00, 0, {}};
+
std::vector<std::string> startingBlobs = {staticLayoutBlobId, hashBlobId};
};