Remove BootControlInterface from FilesystemVerifierAction.
update_engine now only runs FilesystemVerifierAction after DownloadAction,
the partition paths are already set in InstallPlan, so we no longer need
BootControlInterface to get partition paths in FilesystemVerifierAction.
Test: ./update_engine_unittests
Test: applied an update in edison
Bug: 26972259
Change-Id: I9d439688a21e4e42be88a4c5accf731ce64d2d6f
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index 94af2bb..bd4285e 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -46,10 +46,6 @@
}
} // namespace
-FilesystemVerifierAction::FilesystemVerifierAction(
- const BootControlInterface* boot_control)
- : boot_control_(boot_control) {}
-
void FilesystemVerifierAction::PerformAction() {
// Will tell the ActionProcessor we've failed if we return.
ScopedActionCompleter abort_action_completer(processor_, this);
@@ -115,13 +111,11 @@
string part_path;
switch (verifier_step_) {
case VerifierStep::kVerifySourceHash:
- boot_control_->GetPartitionDevice(
- partition.name, install_plan_.source_slot, &part_path);
+ part_path = partition.source_path;
remaining_size_ = partition.source_size;
break;
case VerifierStep::kVerifyTargetHash:
- boot_control_->GetPartitionDevice(
- partition.name, install_plan_.target_slot, &part_path);
+ part_path = partition.target_path;
remaining_size_ = partition.target_size;
break;
}
diff --git a/payload_consumer/filesystem_verifier_action.h b/payload_consumer/filesystem_verifier_action.h
index 6039e02..616f7b7 100644
--- a/payload_consumer/filesystem_verifier_action.h
+++ b/payload_consumer/filesystem_verifier_action.h
@@ -24,7 +24,6 @@
#include <vector>
#include <brillo/streams/stream.h>
-#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "update_engine/common/action.h"
#include "update_engine/common/hash_calculator.h"
@@ -50,7 +49,7 @@
class FilesystemVerifierAction : public InstallPlanAction {
public:
- explicit FilesystemVerifierAction(const BootControlInterface* boot_control);
+ FilesystemVerifierAction() = default;
void PerformAction() override;
void TerminateProcessing() override;
@@ -66,10 +65,6 @@
std::string Type() const override { return StaticType(); }
private:
- friend class FilesystemVerifierActionTest;
- FRIEND_TEST(FilesystemVerifierActionTest,
- RunAsRootDetermineFilesystemSizeTest);
-
// Starts the hashing of the current partition. If there aren't any partitions
// remaining to be hashed, it finishes the action.
void StartPartitionHashing();
@@ -94,9 +89,6 @@
// The type of the partition that we are verifying.
VerifierStep verifier_step_ = VerifierStep::kVerifyTargetHash;
- // The BootControlInterface used to get the partitions based on the slots.
- const BootControlInterface* const boot_control_;
-
// The index in the install_plan_.partitions vector of the partition currently
// being hashed.
size_t partition_index_{0};
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index ad224bc..2e1d95d 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -32,7 +32,6 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#include "update_engine/common/fake_boot_control.h"
#include "update_engine/common/hash_calculator.h"
#include "update_engine/common/test_utils.h"
#include "update_engine/common/utils.h"
@@ -59,7 +58,6 @@
bool DoTest(bool terminate_early, bool hash_fail);
brillo::FakeMessageLoop loop_{nullptr};
- FakeBootControl fake_boot_control_;
};
class FilesystemVerifierActionTestDelegate : public ActionProcessorDelegate {
@@ -155,16 +153,12 @@
part.name = "part";
part.target_size = kLoopFileSize - (hash_fail ? 1 : 0);
part.target_path = a_dev;
- fake_boot_control_.SetPartitionDevice(
- part.name, install_plan.target_slot, a_dev);
if (!HashCalculator::RawHashOfData(a_loop_data, &part.target_hash)) {
ADD_FAILURE();
success = false;
}
part.source_size = kLoopFileSize;
part.source_path = a_dev;
- fake_boot_control_.SetPartitionDevice(
- part.name, install_plan.source_slot, a_dev);
if (!HashCalculator::RawHashOfData(a_loop_data, &part.source_hash)) {
ADD_FAILURE();
success = false;
@@ -174,7 +168,7 @@
ActionProcessor processor;
ObjectFeederAction<InstallPlan> feeder_action;
- FilesystemVerifierAction copier_action(&fake_boot_control_);
+ FilesystemVerifierAction copier_action;
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&feeder_action, &copier_action);
@@ -246,7 +240,7 @@
processor.set_delegate(&delegate);
- FilesystemVerifierAction copier_action(&fake_boot_control_);
+ FilesystemVerifierAction copier_action;
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&copier_action, &collector_action);
@@ -274,7 +268,7 @@
install_plan.partitions = {part};
feeder_action.set_obj(install_plan);
- FilesystemVerifierAction verifier_action(&fake_boot_control_);
+ FilesystemVerifierAction verifier_action;
ObjectCollectorAction<InstallPlan> collector_action;
BondActions(&verifier_action, &collector_action);
diff --git a/update_attempter.cc b/update_attempter.cc
index 751eb52..6dd1483 100644
--- a/update_attempter.cc
+++ b/update_attempter.cc
@@ -638,7 +638,7 @@
system_state_->hardware())),
false));
shared_ptr<FilesystemVerifierAction> filesystem_verifier_action(
- new FilesystemVerifierAction(system_state_->boot_control()));
+ new FilesystemVerifierAction());
shared_ptr<OmahaRequestAction> update_complete_action(
new OmahaRequestAction(
system_state_,
diff --git a/update_attempter_android.cc b/update_attempter_android.cc
index 9f46536..87c7e0d 100644
--- a/update_attempter_android.cc
+++ b/update_attempter_android.cc
@@ -400,7 +400,7 @@
nullptr, // system_state, not used.
new MultiRangeHttpFetcher(download_fetcher))); // passes ownership
shared_ptr<FilesystemVerifierAction> filesystem_verifier_action(
- new FilesystemVerifierAction(boot_control_));
+ new FilesystemVerifierAction());
shared_ptr<PostinstallRunnerAction> postinstall_runner_action(
new PostinstallRunnerAction(boot_control_));
diff --git a/update_attempter_unittest.cc b/update_attempter_unittest.cc
index d8b4318..eb8f16b 100644
--- a/update_attempter_unittest.cc
+++ b/update_attempter_unittest.cc
@@ -285,8 +285,7 @@
EXPECT_EQ(ErrorCode::kOmahaResponseHandlerError,
GetErrorCodeForAction(&omaha_response_handler_action,
ErrorCode::kError));
- FilesystemVerifierAction filesystem_verifier_action(
- fake_system_state_.boot_control());
+ FilesystemVerifierAction filesystem_verifier_action;
EXPECT_EQ(ErrorCode::kFilesystemVerifierError,
GetErrorCodeForAction(&filesystem_verifier_action,
ErrorCode::kError));