summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-11-13 23:41:58 +0100
committerandroid-build-merger <android-build-merger@google.com>2019-11-13 23:41:58 +0100
commit5d1f8cdc82819decac5d22f00a70bf9421407080 (patch)
treeb5a6881a1f13164e1b9f138757c858d7eb9e1ebe /tests
parentMerge "Fixed typo during stopping fastboot" am: 8834b4ea0a am: cfcadc3b33 (diff)
parentMerge "Consolidate the vendor space misc usage for Pixels" am: 423f0d109b (diff)
downloadandroid_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar.gz
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar.bz2
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar.lz
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar.xz
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.tar.zst
android_bootable_recovery-5d1f8cdc82819decac5d22f00a70bf9421407080.zip
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/bootloader_message_test.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/tests/unit/bootloader_message_test.cpp b/tests/unit/bootloader_message_test.cpp
index 95d875e69..731c8feb7 100644
--- a/tests/unit/bootloader_message_test.cpp
+++ b/tests/unit/bootloader_message_test.cpp
@@ -118,37 +118,3 @@ TEST(BootloaderMessageTest, update_bootloader_message_recovery_options_long) {
ASSERT_EQ(std::string(sizeof(boot.reserved), '\0'),
std::string(boot.reserved, sizeof(boot.reserved)));
}
-
-TEST(BootloaderMessageTest, WriteMiscPartitionVendorSpace) {
- TemporaryFile temp_misc;
- ASSERT_TRUE(android::base::WriteStringToFile(std::string(4096, '\x00'), temp_misc.path));
- SetMiscBlockDeviceForTest(temp_misc.path);
-
- constexpr std::string_view kTestMessage = "kTestMessage";
- std::string err;
- ASSERT_TRUE(WriteMiscPartitionVendorSpace(kTestMessage.data(), kTestMessage.size(), 0, &err));
-
- std::string message;
- message.resize(kTestMessage.size());
- ASSERT_TRUE(ReadMiscPartitionVendorSpace(message.data(), message.size(), 0, &err));
- ASSERT_EQ(kTestMessage, message);
-
- // Write with an offset.
- ASSERT_TRUE(WriteMiscPartitionVendorSpace("\x00\x00", 2, 5, &err));
- ASSERT_TRUE(ReadMiscPartitionVendorSpace(message.data(), message.size(), 0, &err));
- ASSERT_EQ("kTest\x00\x00ssage"s, message);
-
- // Write with the right size.
- auto start_offset =
- WIPE_PACKAGE_OFFSET_IN_MISC - VENDOR_SPACE_OFFSET_IN_MISC - kTestMessage.size();
- ASSERT_TRUE(
- WriteMiscPartitionVendorSpace(kTestMessage.data(), kTestMessage.size(), start_offset, &err));
-
- // Out-of-bound write.
- ASSERT_FALSE(WriteMiscPartitionVendorSpace(kTestMessage.data(), kTestMessage.size(),
- start_offset + 1, &err));
-
- // Message won't fit.
- std::string long_message(WIPE_PACKAGE_OFFSET_IN_MISC - VENDOR_SPACE_OFFSET_IN_MISC + 1, 'a');
- ASSERT_FALSE(WriteMiscPartitionVendorSpace(long_message.data(), long_message.size(), 0, &err));
-}