Fix rollback crash while previous rollback is in progress.
The CHECK in Rollback is wrong. We should not be crashing the update_engine
just because we have a previous rollback in progress. This CL changes the
CHECK to a if/else and cleans up the Rollback() logic to be easier to follow
and removes a redundant check for partitions (since CanRollback already
covers this problem).
This CL also cleans up a couple rollback-related unittests.
BUG=chromium:356975
TEST=unittests + on device
Change-Id: Iee8de65eabcddd1dbe6c6413e33a15bf75302260
Reviewed-on: https://chromium-review.googlesource.com/192909
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
diff --git a/fake_hardware.h b/fake_hardware.h
index 161f51a..5aa6a3d 100644
--- a/fake_hardware.h
+++ b/fake_hardware.h
@@ -17,7 +17,7 @@
FakeHardware()
: kernel_device_("/dev/sdz4"),
boot_device_("/dev/sdz5"),
- bootable_devices_({"/dev/sdz4", "/dev/sdz5"}),
+ kernel_devices_({"/dev/sdz2", "/dev/sdz4"}),
is_official_build_(true),
is_normal_boot_mode_(true),
hardware_class_("Fake HWID BLAH-1234"),
@@ -32,7 +32,7 @@
virtual std::string BootDevice() const override { return boot_device_; }
virtual std::vector<std::string> GetKernelDevices() const override {
- return bootable_devices_;
+ return kernel_devices_;
}
virtual bool IsKernelBootable(const std::string& kernel_device,
@@ -91,7 +91,7 @@
private:
std::string kernel_device_;
std::string boot_device_;
- std::vector<std::string> bootable_devices_;
+ std::vector<std::string> kernel_devices_;
std::map<std::string, bool> is_bootable_;
bool is_official_build_;
bool is_normal_boot_mode_;