Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: autotest/server/hardware_TPMFirmwareServer/hardware_TPMFirmwareServer.py

Issue 3335018: vboot_reference: move tests into client/ and also put the server test in here (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2010 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
5 import logging
6 import os
7 import shutil
8 import sys
9 from autotest_lib.server import test, autotest
10 from autotest_lib.client.bin import utils
11 from autotest_lib.client.common_lib import error
12
13 class hardware_TPMFirmwareServer(test.test):
14 """
15 Test of TPM functionality needed in firmware (server side of the test).
16 See also client/site_tests/hardware_TPMFirmware. The server side of the
17 test is used to coordinate the multiple reboots needed to bring the TPM to
18 a new state (for instance between owned and unowned).
19 """
20 version = 1
21 n_client_reboots = 0
22 client_at = None
23
24 # Run the client subtest named [subtest].
25 def tpm_run(self, subtest, ignore_status=False):
26 self.client_at.run_test(self.client_test, subtest=subtest)
27 cstatus = self.job.get_state("client_status")
28 logging.info("server: client status = %s", cstatus)
29 self.job.set_state("client_status", None)
30 if not ignore_status and cstatus != 0:
31 error.TestFail("client subtest %s failed with status %s" %
32 (subtest, cstatus))
33 return cstatus
34
35
36 def reboot_client(self):
37 # Reboot the client
38 logging.info('TPMFirmwareServer: rebooting %s number %d' %
39 (self.client.hostname, self.n_client_reboots))
40 self.client.reboot()
41 self.n_client_reboots += 1
42
43
44 def run_once(self, host=None):
45 self.client = host
46 self.client_at = autotest.Autotest(self.client)
47 self.client_test = 'hardware_TPMFirmware'
48
49 self.job.set_state("client_status", None)
50
51 # Set up the client in the unowned state.
52 self.reboot_client()
53 self.tpm_run("tpmtest_clear", ignore_status=True)
54
55 self.reboot_client()
56 self.tpm_run("tpmtest_enable", ignore_status=True)
57
58 self.reboot_client()
59 self.tpm_run("tpmtest_readonly")
60
61 self.reboot_client()
62 self.tpm_run("tpmtest_globallock")
63
64 self.reboot_client()
65 self.tpm_run("takeownership")
66
67 self.reboot_client()
68 self.tpm_run("tpmtest_readonly")
69
70 self.reboot_client()
71 self.tpm_run("tpmtest_globallock")
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698