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

Unified Diff: autotest/client/hardware_TPMCheck/hardware_TPMCheck.py

Issue 3530018: Autotest that the TPM is in a sane state. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Created 10 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « autotest/client/hardware_TPMCheck/control ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: autotest/client/hardware_TPMCheck/hardware_TPMCheck.py
diff --git a/autotest/client/hardware_TPMCheck/hardware_TPMCheck.py b/autotest/client/hardware_TPMCheck/hardware_TPMCheck.py
new file mode 100644
index 0000000000000000000000000000000000000000..f2fae7e968789a41f5a106013ade96d6aee5dcec
--- /dev/null
+++ b/autotest/client/hardware_TPMCheck/hardware_TPMCheck.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os, re
+from autotest_lib.client.bin import test, utils
+from autotest_lib.client.common_lib import error
+
+def dict_from_command(command):
+ dict = {}
+ out = os.popen(command)
+ for linecr in out.readlines():
+ line = linecr.strip()
+ match = re.match("([^ ]+) (.*)", line)
+ k = match.group(1)
+ v = match.group(2)
+ dict[k] = v
+ return dict
+
+def expect(d, key, value):
+ if (d[key] != value):
+ utils.system("start tcsd", ignore_status=True)
+ raise error.TestError("expecting %s = %s, receiving %s = %s" %
+ (key, value, key, d[key]))
+
+class hardware_TPMCheck(test.test):
+ version = 1
+
+ def run_once(self):
+ utils.system("stop tcsd", ignore_status=True)
+
+ d = dict_from_command("tpmc getvf");
+ expect(d, "deactivated", "0")
+ expect(d, "physicalPresence", "0")
+ expect(d, "physicalPresenceLock", "1")
+ expect(d, "bGlobalLock", "1")
+
+ d = dict_from_command("tpmc getpf");
+ expect(d, "disable", "0")
+ expect(d, "ownership", "1")
+ expect(d, "deactivated", "0")
+ expect(d, "physicalPresenceHWEnable", "0")
+ expect(d, "physicalPresenceCMDEnable", "1")
+ expect(d, "physicalPresenceLifetimeLock", "1")
+ expect(d, "nvLocked", "1")
+
+ utils.system("start tcsd", ignore_status=True)
« no previous file with comments | « autotest/client/hardware_TPMCheck/control ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698