OLD | NEW |
(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 os, re |
| 6 from autotest_lib.client.bin import test, utils |
| 7 from autotest_lib.client.common_lib import error |
| 8 |
| 9 def dict_from_command(command): |
| 10 dict = {} |
| 11 out = os.popen(command) |
| 12 for linecr in out.readlines(): |
| 13 line = linecr.strip() |
| 14 match = re.match("([^ ]+) (.*)", line) |
| 15 k = match.group(1) |
| 16 v = match.group(2) |
| 17 dict[k] = v |
| 18 return dict |
| 19 |
| 20 def expect(d, key, value): |
| 21 if (d[key] != value): |
| 22 utils.system("start tcsd", ignore_status=True) |
| 23 raise error.TestError("expecting %s = %s, receiving %s = %s" % |
| 24 (key, value, key, d[key])) |
| 25 |
| 26 class hardware_TPMCheck(test.test): |
| 27 version = 1 |
| 28 |
| 29 def run_once(self): |
| 30 utils.system("stop tcsd", ignore_status=True) |
| 31 |
| 32 d = dict_from_command("tpmc getvf"); |
| 33 expect(d, "deactivated", "0") |
| 34 expect(d, "physicalPresence", "0") |
| 35 expect(d, "physicalPresenceLock", "1") |
| 36 expect(d, "bGlobalLock", "1") |
| 37 |
| 38 d = dict_from_command("tpmc getpf"); |
| 39 expect(d, "disable", "0") |
| 40 expect(d, "ownership", "1") |
| 41 expect(d, "deactivated", "0") |
| 42 expect(d, "physicalPresenceHWEnable", "0") |
| 43 expect(d, "physicalPresenceCMDEnable", "1") |
| 44 expect(d, "physicalPresenceLifetimeLock", "1") |
| 45 expect(d, "nvLocked", "1") |
| 46 |
| 47 utils.system("start tcsd", ignore_status=True) |
OLD | NEW |