blob: ed421e590c5ab34edc93ae4d95e6e45342342718 [file] [log] [blame]
# Copyright 2012 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Requests that the firmware clear the TPM owner on the next reboot.
Description
-----------
It's required that the owner is cleared on the first boot out of factory.
Users want to minimize the number of reboot in GRT so we don't put this in GRT.
If a user forgets to clear the owner before :doc:`Finalize <finalize>` then the
Finalize will fail at the VerifyTPM.
This should generally be followed by a reboot step.
Test Procedure
--------------
This is an automatic test that doesn't need any user interaction.
Dependency
----------
- ``crossystem clear_tpm_owner_request``
- ``crossystem clear_tpm_owner_done``
Examples
--------
An example:
.. test_list::
generic_tpm_examples:TPMTests.CommonTests.ClearTPMOwnerRequestGroup
"""
import unittest
from cros.factory.test import test_tags
from cros.factory.utils.arg_utils import Arg
from cros.factory.utils import process_utils
class ClearTPMOwnerRequestArgs:
only_check_clear_done: bool
class ClearTPMOwnerRequest(unittest.TestCase):
related_components = (
test_tags.TestCategory.SECURE_ELEMENT,
test_tags.TestCategory.TPM,
)
ARGS = [
Arg('only_check_clear_done', bool, 'Only check crossystem '
'clear_tpm_owner_done=1', default=False)]
args: ClearTPMOwnerRequestArgs
def runTest(self):
if self.args.only_check_clear_done:
self.assertEqual(
process_utils.CheckOutput(['crossystem', 'clear_tpm_owner_done']),
'1')
else:
process_utils.Spawn(['crossystem', 'clear_tpm_owner_request=1'],
check_call=True)