Update_verifier: Remove the support for legacy text format CareMap
We have already switched to the protobuf format for new builds, and
the downgrade packages will require a data wipe. So it should be safe
to drop the support for text format.
This also helps to save the issue when users sideload a package with a
pending OTA, because the new CareMap contains the fingerprint of the
intended build.
Bug: 128536706
Test: unit tests pass, run update_verifier with legacy CareMap
Change-Id: I1c4d0e54ec591f16cc0a65dac76767725ff9e7c4
(cherry picked from commit aaa6103ae72985d061432745e668df9ca29d6ac2)
diff --git a/tests/component/update_verifier_test.cpp b/tests/component/update_verifier_test.cpp
index 0a59403..e27e58c 100644
--- a/tests/component/update_verifier_test.cpp
+++ b/tests/component/update_verifier_test.cpp
@@ -98,7 +98,7 @@
ASSERT_FALSE(verifier_.ParseCareMap());
}
-TEST_F(UpdateVerifierTest, verify_image_smoke) {
+TEST_F(UpdateVerifierTest, verify_image_text_format) {
// This test relies on dm-verity support.
if (!verity_supported) {
GTEST_LOG_(INFO) << "Test skipped on devices without dm-verity support.";
@@ -107,52 +107,14 @@
std::string content = "system\n2,0,1";
ASSERT_TRUE(android::base::WriteStringToFile(content, care_map_txt_));
- ASSERT_TRUE(verifier_.ParseCareMap());
- ASSERT_TRUE(verifier_.VerifyPartitions());
-
- // Leading and trailing newlines should be accepted.
- ASSERT_TRUE(android::base::WriteStringToFile("\n" + content + "\n\n", care_map_txt_));
- ASSERT_TRUE(verifier_.ParseCareMap());
- ASSERT_TRUE(verifier_.VerifyPartitions());
+ // CareMap in text format is no longer supported.
+ ASSERT_FALSE(verifier_.ParseCareMap());
}
TEST_F(UpdateVerifierTest, verify_image_empty_care_map) {
ASSERT_FALSE(verifier_.ParseCareMap());
}
-TEST_F(UpdateVerifierTest, verify_image_wrong_lines) {
- // The care map file can have only 2 / 4 / 6 lines.
- ASSERT_TRUE(android::base::WriteStringToFile("line1", care_map_txt_));
- ASSERT_FALSE(verifier_.ParseCareMap());
-
- ASSERT_TRUE(android::base::WriteStringToFile("line1\nline2\nline3", care_map_txt_));
- ASSERT_FALSE(verifier_.ParseCareMap());
-}
-
-TEST_F(UpdateVerifierTest, verify_image_malformed_care_map) {
- // This test relies on dm-verity support.
- if (!verity_supported) {
- GTEST_LOG_(INFO) << "Test skipped on devices without dm-verity support.";
- return;
- }
-
- std::string content = "system\n2,1,0";
- ASSERT_TRUE(android::base::WriteStringToFile(content, care_map_txt_));
- ASSERT_FALSE(verifier_.ParseCareMap());
-}
-
-TEST_F(UpdateVerifierTest, verify_image_legacy_care_map) {
- // This test relies on dm-verity support.
- if (!verity_supported) {
- GTEST_LOG_(INFO) << "Test skipped on devices without dm-verity support.";
- return;
- }
-
- std::string content = "/dev/block/bootdevice/by-name/system\n2,1,0";
- ASSERT_TRUE(android::base::WriteStringToFile(content, care_map_txt_));
- ASSERT_FALSE(verifier_.ParseCareMap());
-}
-
TEST_F(UpdateVerifierTest, verify_image_protobuf_care_map_smoke) {
// This test relies on dm-verity support.
if (!verity_supported) {