Add a new entry in wipe package to list all wipe partitions

This gives us finer control over the partitions to wipe on the host
side.

Bug: 127492427
Test: unit tests pass, install a wipe package on sailfish
Change-Id: I612f8bac743a310f28e365b490ef388b278cfccb
This commit is contained in:
xunchang
2019-03-05 14:50:51 -08:00
parent 21cfc8b6f4
commit e0d991ceca
3 changed files with 129 additions and 44 deletions
+23
View File
@@ -107,6 +107,29 @@ TEST(InstallTest, read_metadata_from_package_no_entry) {
CloseArchive(zip);
}
TEST(InstallTest, read_wipe_ab_partition_list) {
std::vector<std::string> partition_list = {
"/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",
"/dev/block/bootdevice/by-name/userdata", "# Wipe the boot partitions last",
"/dev/block/bootdevice/by-name/boot_a", "/dev/block/bootdevice/by-name/boot_b",
};
TemporaryFile temp_file;
BuildZipArchive({ { "recovery.wipe", android::base::Join(partition_list, '\n') } },
temp_file.release(), kCompressDeflated);
std::string wipe_package;
ASSERT_TRUE(android::base::ReadFileToString(temp_file.path, &wipe_package));
std::vector<std::string> read_partition_list = GetWipePartitionList(wipe_package);
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",
"/dev/block/bootdevice/by-name/userdata", "/dev/block/bootdevice/by-name/boot_a",
"/dev/block/bootdevice/by-name/boot_b",
};
ASSERT_EQ(expected, read_partition_list);
}
TEST(InstallTest, verify_package_compatibility_with_libvintf_malformed_xml) {
TemporaryFile compatibility_zip_file;
std::string malformed_xml = "malformed";