Implement Rollback to previously booted partitions.
This CL implements rollback to whatever partition we ran from before.
We expose this functionality via dbus under AttemptRollback and expose
a new command-line option to update_engine_client that a developer can
use.
BUG=chromium:242665
TEST=Unittests, full update, update + rollback and verified.
Change-Id: Ie59f90b9a0b777dc1329592449090c70892236bf
Reviewed-on: https://gerrit.chromium.org/gerrit/58427
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/utils_unittest.cc b/utils_unittest.cc
index 4d9dea4..c0e0dfa 100644
--- a/utils_unittest.cc
+++ b/utils_unittest.cc
@@ -283,6 +283,20 @@
EXPECT_EQ(10 * 1024 * 1024 / 4096, block_count);
}
+TEST(UtilsTest, GetInstallDevTest) {
+ string boot_dev = "/dev/sda5";
+ string install_dev;
+ EXPECT_TRUE(utils::GetInstallDev(boot_dev, &install_dev));
+ EXPECT_EQ(install_dev, "/dev/sda3");
+
+ boot_dev = "/dev/sda3";
+ EXPECT_TRUE(utils::GetInstallDev(boot_dev, &install_dev));
+ EXPECT_EQ(install_dev, "/dev/sda5");
+
+ boot_dev = "/dev/sda12";
+ EXPECT_FALSE(utils::GetInstallDev(boot_dev, &install_dev));
+}
+
namespace {
gboolean TerminateScheduleCrashReporterUploadTest(void* arg) {
GMainLoop* loop = reinterpret_cast<GMainLoop*>(arg);