Esempio n. 1
0
 def clear_tpm_if_owned(self):
     """Clear the TPM only if device is already owned."""
     tpm_status = tpm_utils.TPMStatus(self._host)
     logging.info('TPM status: %s', tpm_status)
     if tpm_status['Owned']:
         logging.info('Clearing TPM because this device is owned.')
         tpm_utils.ClearTPMOwnerRequest(self._host)
Esempio n. 2
0
    def run_once(self, host):
        """Clear the tpm owner, reboot the EC, and check the device boots"""
        tpm_utils.ClearTPMOwnerRequest(host)

        logging.info(tpm_utils.TPMStatus(host))

        self.servo.get_power_state_controller().reset()

        end_time = time.time() + self.TIMEOUT
        while utils.ping(host.ip, deadline=5, tries=1):
            if time.time() > end_time:
                self.ec.reboot()
                raise error.TestFail('DUT failed to boot')
            logging.info('DUT is still down (no response to ping)')

        logging.info('DUT is up')

        self.check_state((self.checkers.crossystem_checker, {
            'mainfw_type': 'normal'
        }))
    def run_once(self, host=None):
        self.client = host

        # Skip the test if the TPM is unavailable.
        tpm_status = tpm_utils.TPMStatus(self.client)
        if 'Enabled' not in tpm_status:
            raise error.TestError('Error obtaining TPM enabled state. Status '
                                  'returned by cryptohome: ' + str(tpm_status))
        if not tpm_status['Enabled']:
            raise error.TestNAError("TPM is not enabled")

        # Clear the TPM, so that the client test is able to obtain the TPM owner
        # password.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # Run the client test which executes the Cr50VirtualNVRam test.
        autotest.Autotest(self.client).run_test('firmware_Cr50VirtualNVRam',
                                                check_client_result=True)

        # Clean the TPM up, so that the TPM state set by the firmware
        # tests doesn't affect subsequent tests.
        tpm_utils.ClearTPMOwnerRequest(self.client)
Esempio n. 4
0
    def run_once(self, host=None):
        self.client = host

        # Skip the test if the TPM is unavailable.
        tpm_status = tpm_utils.TPMStatus(self.client)
        if 'Enabled' not in tpm_status:
            raise error.TestError('Error obtaining TPM enabled state. Status '
                                  'returned by cryptohome: ' + str(tpm_status))
        if not tpm_status['Enabled']:
            return

        # Clear the TPM, so that the client test is able to obtain the TPM owner
        # password.
        tpm_utils.ClearTPMOwnerRequest(self.client, wait_for_ready=True)

        # Run the client test which executes the cryptohome's TPM live test.
        autotest.Autotest(self.client).run_test(
            'platform_CryptohomeTpmLiveTest', check_client_result=True)

        # Clean the TPM up, so that the TPM state clobbered by the TPM live
        # tests doesn't affect subsequent tests.
        tpm_utils.ClearTPMOwnerRequest(self.client)