• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2015 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import common
6from autotest_lib.client.common_lib import error
7from autotest_lib.server import test
8
9
10class brillo_FastbootTest(test.test):
11    """Verify that a Brillo device can reboot into / out of fastboot."""
12    version = 1
13
14    def run_once(self, host=None):
15        """Runs the test.
16
17        @param host: A host object representing the DUT.
18
19        @raise TestError: Something went wrong while trying to execute the test.
20        @raise TestFail: The test failed.
21        """
22        # Make sure we're in ADB mode.
23        if not host.is_up():
24            raise error.TestError('Device is not in ADB mode')
25
26        # Switch to fastboot (implies a reboot).
27        try:
28            host.ensure_bootloader_mode()
29        except error.AutoservError as e:
30            raise error.TestFail(
31                    'Failed to reboot the device into fastboot: %s' % e)
32
33        # Now reboot back into ADB.
34        try:
35            host.ensure_adb_mode()
36        except error.AutoservError as e:
37            raise error.TestFail(
38                    'Failed to reboot the device back to ADB: %s' % e)
39