• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2017 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 logging
6import time
7
8from autotest_lib.client.common_lib import error, utils
9from autotest_lib.client.common_lib.cros import tpm_utils
10from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
11
12
13class firmware_ClearTPMOwnerAndReset(FirmwareTest):
14    """
15    Reboot the EC almost immediately after the tpm owner has been cleared.
16    Verify the device can handle this and that it does not boot into recovery.
17    """
18    TIMEOUT=60
19
20
21    def run_once(self, host):
22        """Clear the tpm owner, reboot the EC, and check the device boots"""
23        tpm_utils.ClearTPMOwnerRequest(host)
24
25        logging.info(tpm_utils.TPMStatus(host))
26
27        self.servo.get_power_state_controller().reset()
28
29        end_time = time.time() + self.TIMEOUT
30        while utils.ping(host.ip, deadline=5, tries=1):
31            if time.time() > end_time:
32                self.ec.reboot()
33                raise error.TestFail('DUT failed to boot')
34            logging.info('DUT is still down (no response to ping)')
35
36        logging.info('DUT is up')
37
38        self.check_state((self.checkers.crossystem_checker,
39                          {'mainfw_type': 'normal'}))
40        if not self.faft_client.system.dev_tpm_present():
41            raise error.TestError('/dev/tpm0 does not exist on the client')
42