tests: Add a test to cover legacy care_map.txt handling.

This is to cover the code added by commit
5a1dee01df, where an O update_verifier
should not reject N care_map.txt.

Bug: 63544345
Test: recovery_component_test passes on marlin.
Change-Id: Ia944e16cba3cc635098b3ffd92842d725b570fec
This commit is contained in:
Tao Bao 2017-07-24 09:22:39 -07:00
parent 15ae0f01c3
commit c319613e06

View file

@ -81,3 +81,16 @@ TEST_F(UpdateVerifierTest, verify_image_malformed_care_map) {
ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file.path));
ASSERT_FALSE(verify_image(temp_file.path));
}
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;
}
TemporaryFile temp_file;
std::string content = "/dev/block/bootdevice/by-name/system\n2,1,0";
ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file.path));
ASSERT_TRUE(verify_image(temp_file.path));
}