Clean up dead code in FilesystemVerifierAction.
Now that we switched to minor version 3, those code is dead.
The disabled unittest is using CreateExtImageAtPath which I'm about to
remove, so I'm removing this code now.
Test: mma
Bug: 26972259
Change-Id: Ic6a9b9e87e5e2aa09011cf005a4dee78391c6901
diff --git a/payload_consumer/filesystem_verifier_action.cc b/payload_consumer/filesystem_verifier_action.cc
index 759b455..4d7d3dc 100644
--- a/payload_consumer/filesystem_verifier_action.cc
+++ b/payload_consumer/filesystem_verifier_action.cc
@@ -57,42 +57,6 @@
}
install_plan_ = GetInputObject();
- // For delta updates (major version 1) we need to populate the source
- // partition hash if not pre-populated.
- if (install_plan_.payload_type == InstallPayloadType::kDelta &&
- install_plan_.partitions.empty() &&
- verifier_mode_ == VerifierMode::kComputeSourceHash &&
- DeltaPerformer::kSupportedMinorPayloadVersion <
- kOpSrcHashMinorPayloadVersion) {
- LOG(INFO) << "Using legacy partition names.";
- InstallPlan::Partition part;
- string part_path;
-
- part.name = kLegacyPartitionNameRoot;
- if (!boot_control_->GetPartitionDevice(
- part.name, install_plan_.source_slot, &part_path))
- return;
- int block_count = 0, block_size = 0;
- if (utils::GetFilesystemSize(part_path, &block_count, &block_size)) {
- part.source_size = static_cast<int64_t>(block_count) * block_size;
- LOG(INFO) << "Partition " << part.name << " size: " << part.source_size
- << " bytes (" << block_count << "x" << block_size << ").";
- }
- install_plan_.partitions.push_back(part);
-
- part.name = kLegacyPartitionNameKernel;
- if (!boot_control_->GetPartitionDevice(
- part.name, install_plan_.source_slot, &part_path))
- return;
- off_t kernel_part_size = utils::FileSize(part_path);
- if (kernel_part_size < 0)
- return;
- LOG(INFO) << "Partition " << part.name << " size: " << kernel_part_size
- << " bytes.";
- part.source_size = kernel_part_size;
- install_plan_.partitions.push_back(part);
- }
-
if (install_plan_.partitions.empty()) {
LOG(INFO) << "No partitions to verify.";
if (HasOutputPipe())
diff --git a/payload_consumer/filesystem_verifier_action_unittest.cc b/payload_consumer/filesystem_verifier_action_unittest.cc
index 1b5d32a..fdc94d9 100644
--- a/payload_consumer/filesystem_verifier_action_unittest.cc
+++ b/payload_consumer/filesystem_verifier_action_unittest.cc
@@ -327,54 +327,4 @@
while (loop_.RunOnce(false)) {}
}
-// Disabled as we switched to minor version 3, so this test is obsolete, will be
-// deleted when we delete the corresponding code in PerformAction().
-// Test that the rootfs and kernel size used for hashing in delta payloads for
-// major version 1 is properly read.
-TEST_F(FilesystemVerifierActionTest,
- DISABLED_RunAsRootDetermineLegacySizeTest) {
- string img;
- EXPECT_TRUE(utils::MakeTempFile("img.XXXXXX", &img, nullptr));
- ScopedPathUnlinker img_unlinker(img);
- test_utils::CreateExtImageAtPath(img, nullptr);
- // Extend the "partition" holding the file system from 10MiB to 20MiB.
- EXPECT_EQ(0, truncate(img.c_str(), 20 * 1024 * 1024));
-
- InstallPlan install_plan;
- install_plan.source_slot = 1;
-
- fake_boot_control_.SetPartitionDevice(
- kLegacyPartitionNameRoot, install_plan.source_slot, img);
- fake_boot_control_.SetPartitionDevice(
- kLegacyPartitionNameKernel, install_plan.source_slot, img);
- FilesystemVerifierAction action(&fake_boot_control_,
- VerifierMode::kComputeSourceHash);
-
- ObjectFeederAction<InstallPlan> feeder_action;
- feeder_action.set_obj(install_plan);
-
- ObjectCollectorAction<InstallPlan> collector_action;
-
- BondActions(&feeder_action, &action);
- BondActions(&action, &collector_action);
- ActionProcessor processor;
- processor.EnqueueAction(&feeder_action);
- processor.EnqueueAction(&action);
- processor.EnqueueAction(&collector_action);
-
- loop_.PostTask(FROM_HERE,
- base::Bind([&processor]{ processor.StartProcessing(); }));
- loop_.Run();
- install_plan = collector_action.object();
-
- ASSERT_EQ(2U, install_plan.partitions.size());
- // When computing the size of the rootfs on legacy delta updates we use the
- // size of the filesystem, but when updating the kernel we use the whole
- // partition.
- EXPECT_EQ(10U << 20, install_plan.partitions[0].source_size);
- EXPECT_EQ(kLegacyPartitionNameRoot, install_plan.partitions[0].name);
- EXPECT_EQ(20U << 20, install_plan.partitions[1].source_size);
- EXPECT_EQ(kLegacyPartitionNameKernel, install_plan.partitions[1].name);
-}
-
} // namespace chromeos_update_engine