blob: e6ccd567e0e158c7b09751a547fc96800b57efb2 [file] [log] [blame]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from autotest_lib.server import test
from autotest_lib.server.cros import autoupdate_utils
class autoupdate_Rollback(test.test):
"""Test that updates the machine and performs rollback."""
version = 1
def run_once(self, host, job_repo_url=None):
"""Runs the test.
@param host: A host object representing the DUT.
@param job_repo_url: URL to get the image.
@raise error.TestError if anything went wrong with setting up the test;
error.TestFail if any part of the test has failed.
updater = autoupdate_utils.get_updater_from_repo_url(host, job_repo_url)
initial_kernel, updated_kernel = updater.get_kernel_state()'Initial device state: active kernel %s, '
'inactive kernel %s.', initial_kernel, updated_kernel)'Performing an update.')
# We should be booting from the new partition.
error_message = 'Failed to set up test by updating DUT.'
rollback_message=error_message)'Update verified, initiating rollback.')
# Powerwash is tested separately from rollback.
# We should be back on our initial partition.
error_message = ('Autoupdate reported that rollback succeeded but we '
'did not boot into the correct partition.')
rollback_message=error_message)'We successfully rolled back to initial kernel.')