summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2019-03-14 04:08:44 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2019-03-14 04:08:44 +0100
commite009a3de7a2d4dc68c8a3d07f88a6949137f3e27 (patch)
treef58346295dac487454525c7b6df54bf8955db61d /tests
parentSnap for 5370966 from 28e7cca4cb40622d6847b5dda654af02dcfa004f to qt-release (diff)
parentMerge "Update_verifier: Remove the support for legacy text format CareMap" (diff)
downloadandroid_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar.gz
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar.bz2
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar.lz
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar.xz
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.tar.zst
android_bootable_recovery-e009a3de7a2d4dc68c8a3d07f88a6949137f3e27.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/component/install_test.cpp5
-rw-r--r--tests/component/update_verifier_test.cpp44
2 files changed, 7 insertions, 42 deletions
diff --git a/tests/component/install_test.cpp b/tests/component/install_test.cpp
index 117813694..969805b42 100644
--- a/tests/component/install_test.cpp
+++ b/tests/component/install_test.cpp
@@ -120,7 +120,10 @@ TEST(InstallTest, read_wipe_ab_partition_list) {
std::string wipe_package;
ASSERT_TRUE(android::base::ReadFileToString(temp_file.path, &wipe_package));
- std::vector<std::string> read_partition_list = GetWipePartitionList(wipe_package);
+ auto package = Package::CreateMemoryPackage(
+ std::vector<uint8_t>(wipe_package.begin(), wipe_package.end()), nullptr);
+
+ auto read_partition_list = GetWipePartitionList(package.get());
std::vector<std::string> expected = {
"/dev/block/bootdevice/by-name/system_a", "/dev/block/bootdevice/by-name/system_b",
"/dev/block/bootdevice/by-name/vendor_a", "/dev/block/bootdevice/by-name/vendor_b",
diff --git a/tests/component/update_verifier_test.cpp b/tests/component/update_verifier_test.cpp
index 0a594037c..e27e58c22 100644
--- a/tests/component/update_verifier_test.cpp
+++ b/tests/component/update_verifier_test.cpp
@@ -98,7 +98,7 @@ TEST_F(UpdateVerifierTest, verify_image_no_care_map) {
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,49 +107,11 @@ TEST_F(UpdateVerifierTest, verify_image_smoke) {
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());
-}
-
-TEST_F(UpdateVerifierTest, verify_image_empty_care_map) {
+ // CareMap in text format is no longer supported.
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_));
+TEST_F(UpdateVerifierTest, verify_image_empty_care_map) {
ASSERT_FALSE(verifier_.ParseCareMap());
}