Move InstallPlan partitions to a list of partitions.
This patch changes the InstallPlan instance from having hard-coded
rootfs and kernel paritions to have a list of partitions with a
name, source and target information.
The FilesystemVerifierAction, DeltaPerformer and PostInstallAction were
adapter to use the list of partitions instead.
In delta payloads (only supported in the current major version 1) the
list of operations is still fixed: the rootfs first and the kernel.
This list is now populated by the FilesystemVerifierAction including
the size of these partitions, until the whole source partition hash
checking is deprecated (b/23182225).
The PostIntallAction now relies on the DeltaPerformer to populate the
post-install information from the payload. This means that in rollback
we won't run any device-specific post-install operation, and will
simply flip the slots in the bootloader.
Bug: 24667689
Test: Updated unittests. Tested on a dragonboard and a link.
Change-Id: I8277e3190ac74e57832a58dc0730e3713f48af8a
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index 51e7920..1f506df 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -292,7 +292,7 @@
GetErrorCodeForAction(&omaha_response_handler_action,
ErrorCode::kError));
FilesystemVerifierAction filesystem_verifier_action(
- &fake_system_state_, PartitionType::kRootfs);
+ fake_system_state_.boot_control(), VerifierMode::kVerifyTargetHash);
EXPECT_EQ(ErrorCode::kFilesystemVerifierError,
GetErrorCodeForAction(&filesystem_verifier_action,
ErrorCode::kError));
@@ -383,12 +383,10 @@
OmahaRequestAction::StaticType(),
OmahaResponseHandlerAction::StaticType(),
FilesystemVerifierAction::StaticType(),
- FilesystemVerifierAction::StaticType(),
OmahaRequestAction::StaticType(),
DownloadAction::StaticType(),
OmahaRequestAction::StaticType(),
FilesystemVerifierAction::StaticType(),
- FilesystemVerifierAction::StaticType(),
PostinstallRunnerAction::StaticType(),
OmahaRequestAction::StaticType()
};
@@ -437,7 +435,7 @@
EXPECT_EQ(attempter_.response_handler_action_.get(),
attempter_.actions_[1].get());
DownloadAction* download_action =
- dynamic_cast<DownloadAction*>(attempter_.actions_[5].get());
+ dynamic_cast<DownloadAction*>(attempter_.actions_[4].get());
ASSERT_NE(nullptr, download_action);
EXPECT_EQ(&attempter_, download_action->delegate());
EXPECT_EQ(UpdateStatus::CHECKING_FOR_UPDATE, attempter_.status());
@@ -453,21 +451,12 @@
EXPECT_CALL(*device_policy, LoadPolicy()).WillRepeatedly(Return(true));
fake_system_state_.set_device_policy(device_policy);
- FakeBootControl* fake_boot_control = fake_system_state_.fake_boot_control();
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameKernel, 0, "/dev/sdz2");
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameRoot, 0, "/dev/sdz3");
-
if (valid_slot) {
BootControlInterface::Slot rollback_slot = 1;
LOG(INFO) << "Test Mark Bootable: "
<< BootControlInterface::SlotName(rollback_slot);
- fake_boot_control->SetSlotBootable(rollback_slot, true);
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameKernel, rollback_slot, "/dev/sdz4");
- fake_boot_control->SetPartitionDevice(
- kLegacyPartitionNameRoot, rollback_slot, "/dev/sdz5");
+ fake_system_state_.fake_boot_control()->SetSlotBootable(rollback_slot,
+ true);
}
bool is_rollback_allowed = false;
@@ -520,8 +509,7 @@
InstallPlanAction* install_plan_action =
dynamic_cast<InstallPlanAction*>(attempter_.actions_[0].get());
InstallPlan* install_plan = install_plan_action->install_plan();
- EXPECT_EQ(install_plan->install_path, string("/dev/sdz5"));
- EXPECT_EQ(install_plan->kernel_install_path, string("/dev/sdz4"));
+ EXPECT_EQ(0, install_plan->partitions.size());
EXPECT_EQ(install_plan->powerwash_required, true);
loop_.BreakLoop();
}