From 8d6df9ac7a70f4b07ebb86f50fb3548b693acad5 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 13 Aug 2020 13:59:54 -0700 Subject: Check allocatable space correctly when sideloading on VAB On a device with Virtual A/B, when sideloading and there's not enough space in super partition to hold CoW, update_engine falls back to overwriting all source partitions. In that case, the allocatable space should be the whole super partition, not a half of it. Also update doc comments. Test: unit test. RecoveryErrorShouldDeleteSource fails without the patch but succeeds with the patch. Bug: 163613538 Change-Id: I6bd6895a7eabeb4e8436e57b0ac6830c11d1e98f --- dynamic_partition_test_utils.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dynamic_partition_test_utils.h') diff --git a/dynamic_partition_test_utils.h b/dynamic_partition_test_utils.h index 70a176b5..d701dce8 100644 --- a/dynamic_partition_test_utils.h +++ b/dynamic_partition_test_utils.h @@ -175,9 +175,11 @@ inline DeltaArchiveManifest PartitionSizesToManifest( } inline std::unique_ptr NewFakeMetadata( - const DeltaArchiveManifest& manifest, uint32_t partition_attr = 0) { + const DeltaArchiveManifest& manifest, + uint32_t partition_attr = 0, + uint64_t super_size = kDefaultSuperSize) { auto builder = - MetadataBuilder::New(kDefaultSuperSize, kFakeMetadataSize, kMaxNumSlots); + MetadataBuilder::New(super_size, kFakeMetadataSize, kMaxNumSlots); for (const auto& group : manifest.dynamic_partition_metadata().groups()) { EXPECT_TRUE(builder->AddGroup(group.name(), group.size())); for (const auto& partition_name : group.partition_names()) { -- cgit v1.2.3