diff options
author | Alex Deymo <deymo@google.com> | 2015-08-27 21:08:08 -0700 |
---|---|---|
committer | Alex Deymo <deymo@google.com> | 2015-08-28 15:55:29 -0700 |
commit | 763e7dbaac735da0ae802933a1015b6b7874bce2 (patch) | |
tree | 7f0da302e2ee26f95c6fdd5b4667a696181f699a /filesystem_verifier_action_unittest.cc | |
parent | 8a7d0ca79fba87411bd0d105f5eb502c61be269a (diff) |
update_engine: New BootControlInterface class.
The new BootControlInterface class is a platform-independent
abstraction to control the bootloader. It provides methods for setting
what partition slots are available for booting and getting the
bootloader status about the available slots.
The Chrome OS specific implementation of the bootloader was moved to
the BootControlChromeOS which now depends on the vboot_host
implementation used in Chrome OS. Follow up CL will implement the
equivalent class for Brillo.
BUG=b:23010637
TEST=unittests; cros flash from the new image and rolled back from it.
Change-Id: I0a03aeeb8c21d8c99e1866b625e6e8c96628215b
Diffstat (limited to 'filesystem_verifier_action_unittest.cc')
-rw-r--r-- | filesystem_verifier_action_unittest.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/filesystem_verifier_action_unittest.cc b/filesystem_verifier_action_unittest.cc index 37cdf380..32f3c59e 100644 --- a/filesystem_verifier_action_unittest.cc +++ b/filesystem_verifier_action_unittest.cc @@ -131,11 +131,6 @@ TEST_F(FilesystemVerifierActionTest, DISABLED_RunAsRootSimpleTest) { bool FilesystemVerifierActionTest::DoTest(bool terminate_early, bool hash_fail, PartitionType partition_type) { - // We need MockHardware to verify MarkUnbootable calls, but don't want - // warnings about other usages. - testing::NiceMock<MockHardware> mock_hardware; - fake_system_state_.set_hardware(&mock_hardware); - string a_loop_file; if (!(utils::MakeTempFile("a_loop_file.XXXXXX", &a_loop_file, nullptr))) { @@ -170,6 +165,8 @@ bool FilesystemVerifierActionTest::DoTest(bool terminate_early, // Set up the action objects InstallPlan install_plan; + install_plan.source_slot = 0; + install_plan.target_slot = 1; switch (partition_type) { case PartitionType::kRootfs: install_plan.rootfs_size = kLoopFileSize - (hash_fail ? 1 : 0); @@ -207,9 +204,8 @@ bool FilesystemVerifierActionTest::DoTest(bool terminate_early, break; } - EXPECT_CALL(mock_hardware, - MarkKernelUnbootable(a_dev)).Times( - partition_type == PartitionType::kKernel ? 1 : 0); + fake_system_state_.fake_boot_control()->SetSlotBootable( + install_plan.target_slot, true); ActionProcessor processor; @@ -269,12 +265,12 @@ bool FilesystemVerifierActionTest::DoTest(bool terminate_early, success = success && is_install_plan_eq; LOG(INFO) << "Verifying bootable flag on: " << a_dev; - bool bootable; - EXPECT_TRUE(mock_hardware.fake().IsKernelBootable(a_dev, &bootable)); + // We should always mark a partition as unbootable if it's a kernel // partition, but never if it's anything else. - EXPECT_EQ(bootable, (partition_type != PartitionType::kKernel)); - + EXPECT_EQ((partition_type != PartitionType::kKernel), + fake_system_state_.fake_boot_control()->IsSlotBootable( + install_plan.target_slot)); return success; } |