CHERRY-PICK: Fix autotest support for a new TPM class directory.
Kernel TPM patches from 4.x moved /sys/class/misc/tpm0 to /sys/class/tpm/tpm0.
The last attempt to support both paths in firmware_TPMExtend failed to
differentiate between host and device operation. Rather than add a second
device operation to check the path, simply use the wildcard to find the
right file.
This assumes (safely, I think) that the system has only one tpm0.
BUG=chrome-os-partner:49763
TEST=Confirm firmware_TPMExtend gives valid "Dumping PCRs read from device"
data in both 3.18 and 3.14 kernels.
Change-Id: I06626370c8ae90fd8fb754a9b2a6bd895e46ad62
Reviewed-on: https://chromium-review.googlesource.com/328817
Commit-Ready: Bryan Freed <bfreed@chromium.org>
Tested-by: Bryan Freed <bfreed@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
(cherry picked from commit 0b271ea59e5d8dbabdd07a766ba166f166a9baa5)
Reviewed-on: https://chromium-review.googlesource.com/374223
Reviewed-by: David Wu <david_wu@quantatw.com>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
Commit-Queue: David Wu <david_wu@quantatw.com>
Tested-by: David Wu <david_wu@quantatw.com>
diff --git a/server/site_tests/firmware_TPMExtend/firmware_TPMExtend.py b/server/site_tests/firmware_TPMExtend/firmware_TPMExtend.py
index 44b355f..842a679 100644
--- a/server/site_tests/firmware_TPMExtend/firmware_TPMExtend.py
+++ b/server/site_tests/firmware_TPMExtend/firmware_TPMExtend.py
@@ -2,7 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-import hashlib, logging, os
+import hashlib, logging
from autotest_lib.client.common_lib import error
from autotest_lib.server.cros.faft.firmware_test import FirmwareTest
@@ -19,9 +19,7 @@
def _check_pcr(self, num, hash_obj):
"""Returns true iff PCR |num| was extended with hashlib |hash_obj|."""
- pcrs_file='/sys/class/misc/tpm0/device/pcrs'
- if not os.path.exists(pcrs_file):
- pcrs_file='/sys/class/tpm/tpm0/device/pcrs'
+ pcrs_file='/sys/class/*/tpm0/device/pcrs'
pcrs = '\n'.join(self.faft_client.system.run_shell_command_get_output(
'cat %s' % pcrs_file))
logging.debug('Dumping PCRs read from device: \n%s', pcrs)