diff options
author | Tianjie <xunchang@google.com> | 2021-03-15 16:00:50 -0700 |
---|---|---|
committer | Tianjie Xu <xunchang@google.com> | 2021-03-27 07:00:33 +0000 |
commit | 9f4dc7f49d76d30aaa14bfc103e8fc619268a1bc (patch) | |
tree | dc04096a2c0c00d4b80c388033b4808c60ad4bd5 /aosp/dynamic_partition_control_android_unittest.cc | |
parent | 21a4991833d778725eef1fdbf7866c3aa0f1dbad (diff) |
Check the super partiton size in VAB case
When the snapshot is used, we should check that the maximum size
of all dynamic partition groups doesn't exceed the super partition
size.
Bug: 182431975
Test: primary payload fails as expected Pixel21
Change-Id: I5df8976e6b7e011284b29fd554dda80e31305698
Diffstat (limited to 'aosp/dynamic_partition_control_android_unittest.cc')
-rw-r--r-- | aosp/dynamic_partition_control_android_unittest.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/aosp/dynamic_partition_control_android_unittest.cc b/aosp/dynamic_partition_control_android_unittest.cc index eb3f60cc..0bb8df7a 100644 --- a/aosp/dynamic_partition_control_android_unittest.cc +++ b/aosp/dynamic_partition_control_android_unittest.cc @@ -1051,6 +1051,7 @@ class SnapshotPartitionTestP : public DynamicPartitionControlAndroidTestP { // Test happy path of PreparePartitionsForUpdate on a Virtual A/B device. TEST_P(SnapshotPartitionTestP, PreparePartitions) { ExpectCreateUpdateSnapshots(android::snapshot::Return::Ok()); + SetMetadata(source(), {}); uint64_t required_size = 0; EXPECT_TRUE(PreparePartitionsForUpdate(&required_size)); EXPECT_EQ(0u, required_size); @@ -1061,6 +1062,8 @@ TEST_P(SnapshotPartitionTestP, PreparePartitions) { TEST_P(SnapshotPartitionTestP, PreparePartitionsNoSpace) { ExpectCreateUpdateSnapshots(android::snapshot::Return::NoSpace(1_GiB)); uint64_t required_size = 0; + + SetMetadata(source(), {}); EXPECT_FALSE(PreparePartitionsForUpdate(&required_size)); EXPECT_EQ(1_GiB, required_size); } @@ -1070,6 +1073,10 @@ TEST_P(SnapshotPartitionTestP, PreparePartitionsNoSpace) { TEST_P(SnapshotPartitionTestP, RecoveryUseSuperEmpty) { ExpectCreateUpdateSnapshots(android::snapshot::Return::Ok()); EXPECT_CALL(dynamicControl(), IsRecovery()).WillRepeatedly(Return(true)); + + // Metadata is needed to perform super partition size check. + SetMetadata(source(), {}); + // Must not call PrepareDynamicPartitionsForUpdate if // PrepareSnapshotPartitionsForUpdate succeeds. EXPECT_CALL(dynamicControl(), PrepareDynamicPartitionsForUpdate(_, _, _, _)) |