summaryrefslogtreecommitdiff
path: root/dynamic_partition_control_android_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Check the super partiton size in VAB caseTianjie2021-07-061-0/+7
| | | | | | | | | | 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
* Check allocatable space correctly when sideloading on VABYifan Hong2021-07-061-3/+116
| | | | | | | | | | | | | | | | 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
* Add DynamicPartitionControl::EraseSystemOtherAvbFooterYifan Hong2020-04-081-3/+138
| | | | | | | | | | | | | | | | | Erase AVB footer of system other partition prior to any updates so that if an update overwrites it partially, and the device rolled back (or even before we finish writing the partition), and the device factory resets, mapping system_other as /postinstall won't trigger verity errors and reboots the device. Fixes: 152444348 Test: apply update, rollback, then FDR Test: apply update, then set sys.cppreopt=requested; observe that /postinstall cannot be mounted. Change-Id: I62e5bb8f4c31d9a1beff485c47fc4b07a3a5686b (cherry picked from commit 2969290920696611a67aed184baf71cac062b416) Merged-In: I62e5bb8f4c31d9a1beff485c47fc4b07a3a5686b
* ResetStatus deletes snapshots for VAB.Yifan Hong2020-03-171-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ResetStatus() is called, delete snapshots to free up space on VAB devices. On regular A/B, there is no need to cancel the update completely so that the update may be resumed next time. However, on VAB devices, a cancelled update should not occupy previously allocated space. Test: manually call update_engine_client --cancel when an update is in progress, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually kill update_engine when an update is in progress, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually apply an update until UPDATED_NEED_REBOOT, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually apply an update until UPDATED_NEED_REBOOT, then kill update_engine, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Bug: 147696014 Change-Id: Ic7049772091a34e0e666fd7ae361ef474d5a28aa Merged-In: Ic7049772091a34e0e666fd7ae361ef474d5a28aa
* ShouldSkipOperation -> OptimizeOperationYifan Hong2020-03-121-13/+50
| | | | | | | | | | | | | | | | For SOURCE_COPY operations like 563412 -> 123456 OptimizeOperation optimizes it to 5612 -> 1256 and skip writing blocks that does not need to be written for snapshot partitions. Bug: 148623880 Test: update_engine_unittests Test: apply incremental OTA Change-Id: Ifd2c3851f703f272a74c8f0e9a1c9a82dbcce3e3 Merged-In: Ifd2c3851f703f272a74c8f0e9a1c9a82dbcce3e3
* DynamicPartitionControl: Add required_size to PrepareYifan Hong2020-01-161-4/+13
| | | | | | | | | | | Add out parameter required_size to PreparePartitionsForUpdate to indicate the total size required on /userdata in order to apply the update. Bug: 138808058 Test: update_engine_unittests Change-Id: I2768d13671e212fd24a1a22811b50c9738834459
* Only skip operation on snapshot partitionsYifan Hong2019-12-041-12/+19
| | | | | | | | | On Virtual A/B devices, don't skip SOURCE_COPY on static partitions. Test: update_engine_unittest Test: incremental update to self Change-Id: I5c93b501e09f50f559151eb77d83052373c90d0d
* Skip identical SOURCE_COPY operationsAlessio Balsini2019-12-041-0/+82
| | | | | | | | | | | | | | | | When Virtual A/B devices are updated, SOURCE_COPY operations that are copying data from source to destination at the same locations: - are useless; - introduce an overhead for overwritingin identical data; - increase the COW device size when using dm-snapshot. This patch analyzes SOURCE_COPY operations and skips them if applied to Virtual A/B devices and source and destination addresses are identical. Bug: 141207436 Test: DynamicPartitionControlAndroidTest:ShouldSkipOperationTest Depends-On: I146aeba1c8ede35f21cfef8e21d4af62274bda84 Change-Id: Ifec33abaf81b1d4cbd61533293735de68578c9c4 Signed-off-by: Alessio Balsini <balsini@google.com>
* Proper split of BootControl and DynamicPartitionControl.Yifan Hong2019-11-131-0/+130
| | | | | | | | | | | | | | | | | | | | | All dynamic/static partitions stuff are moved to DynamicPartitionControlAndroid. After this patch: (1) BootControl remains a simple shim over the boot control HAL. (BootControl still have two calls that is a delegate to DynamicPartitionControl, which will be cleaned up in follow up CLs.) (2) DynamicPartitionControlInterface API is minimized. All libdm and other Android specific details are hidden from the API surface now. Also move tests from boot_control_unittest to dynamic_partition_control_unittest because functionalities are moved. Test: update_engine_unittests Change-Id: I6ed902197569f9f0ef40e02703634e9078a4b060
* DynamicPartitionControl: only create snapshot when snapshot_enabledYifan Hong2019-10-171-1/+1
| | | | | | | | | | | | Do not create snapshot when applying downgrade to non-Virtual-A/B packages and secondary OTAs. Test: apply downgrade OTA on Virtual A/B devices Bug: 138733621 (secondary OTA) Fixes: 138258570 (downgrades) Change-Id: I13318f57613d6bd60a5b7e81ebb3e35b3c225a0c
* [REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControlYifan Hong2019-09-231-78/+81
| | | | | | | | | | | | | | DynamicPartitionControl need the list of operations to calculate COW sizes. - Remove BootControlInterface::PartitionMetadata. Replace all references with DeltaArchiveManifest. DeltaArchiveManifest has all information that PartitionMetadata has. - Rename all InitPartitionMetadata to PreparePartitionsForUpdate - Change all PreparePartitionsForUpdate to use new signature Bug: 138816109 Test: update_enigne_unittests --gtest_filter=*BootControl*:*Dynamic* Change-Id: I4389ba2b1801addf8c3bc8395e2ea6a9a3ed27a0
* DynamicPartitionsControl: Add Virtual A/B feature flag.Yifan Hong2019-08-291-0/+2
| | | | | | Test: unittest Bug: 138816109 Change-Id: I7ae65ba0bf36a6ca5085bc4ec2c46245288b4703
* [REFACTOR] DynamicPartitionControl: Add GetSuperPartitionNameYifan Hong2019-07-311-0/+7
| | | | | | | | | | | | | fs_mgr_get_super_partition_name() should be mocked because it is an external dependency to libfs_mgr. In tests, deliberately make GetSuperDevice() to return "fake_super" instead of "super" to make sure it is mocked properly. Test: run unittests Test: manually apply OTA Change-Id: I0f05d99bf168b6e658052b4bd67dc1e82ab36471
* [REFACTOR] Move and refactor tests.Yifan Hong2019-07-311-0/+477
Some tests from boot_control_android_unittest only test logic of UpdatePartitionMetadata. Move them to dynamic_partition_control_android_unittest. After moving the test, boot_control_android_unittest can depend on the MockDynamicPartitionControl (which is a mocked DynamicPartitionControlInterface) directly again. It no longer depends on internal implementation of DynamicPartitionControlAndroid. Test: unittest Fixes: 138333673 Change-Id: Idc5f11be98754b8f6d38fcb8604af497e5d86376