diff options
author | Tianjie Xu <xunchang@google.com> | 2019-03-08 03:14:39 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-08 03:14:39 +0100 |
commit | de902a5f9b74f132b6c8191abe88cf0ddb8dc535 (patch) | |
tree | a1ca8ee5fe95cea0b35ce12cc6b66d68fa400540 /tests | |
parent | Merge "Use O_CLOEXEC at a few places." am: e3857ca43e am: 4e95d7503e (diff) | |
parent | Merge "Add a new entry in wipe package to list all wipe partitions" am: a8969842ae (diff) | |
download | android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar.gz android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar.bz2 android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar.lz android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar.xz android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.tar.zst android_bootable_recovery-de902a5f9b74f132b6c8191abe88cf0ddb8dc535.zip |
Diffstat (limited to 'tests')
-rw-r--r-- | tests/component/install_test.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/component/install_test.cpp b/tests/component/install_test.cpp index 47a54714c..117813694 100644 --- a/tests/component/install_test.cpp +++ b/tests/component/install_test.cpp @@ -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"; |