Index: autotest/client/hardware_TPMFirmware/hardware_TPMFirmware.py |
diff --git a/autotest/client/hardware_TPMFirmware/hardware_TPMFirmware.py b/autotest/client/hardware_TPMFirmware/hardware_TPMFirmware.py |
index 9fc9a82a6f887ed9bf05114e6aa3500ee44309da..8be2b791235c05733f16c3c8c8326e51391fb3b2 100644 |
--- a/autotest/client/hardware_TPMFirmware/hardware_TPMFirmware.py |
+++ b/autotest/client/hardware_TPMFirmware/hardware_TPMFirmware.py |
@@ -13,17 +13,9 @@ class hardware_TPMFirmware(test.test): |
version = 1 |
preserve_srcdir = True |
- # Cross-compiles TLCL test suite and other needed code. |
- # TODO(semenzato): tpm_takeownership is currently available by making |
- # tpm-tools an RDEPEND in the autotest ebuild. See that file for a |
- # better way. |
def setup(self): |
- sysroot = os.environ['SYSROOT'] |
- bin_path = os.path.join(sysroot, 'usr/sbin/tpm_takeownership') |
- shutil.copy(bin_path, self.bindir) |
utils.make('-C %s' % self.srcdir) |
- |
# Runs a command, logs the output, and returns the exit status. |
def tpm_run(self, cmd, ignore_status=False): |
output = utils.run(cmd, ignore_status=ignore_status) |
@@ -31,31 +23,15 @@ class hardware_TPMFirmware(test.test): |
self.job.set_state("client_status", output.exit_status) |
- # Sets up the system (if it isn't already) to run the tpm binaries. This |
- # is mostly needed after a reboot. We don't rely on the system booting in |
- # any particular state. |
- def tpm_setup(self, with_tcsd=False): |
- utils.run('mknod /dev/tpm c 10 224', ignore_status=True) |
- utils.run('mknod /dev/tpm0 c 10 224', ignore_status=True) |
- utils.run('modprobe tpm_tis force=1 interrupts=0', ignore_status=True) |
- |
- if (with_tcsd): |
- utils.run('/usr/sbin/tcsd') |
- else: |
- # It will be a problem if upstart automatically restarts tcsd. |
- utils.run('pkill tcsd', ignore_status=True) |
- |
- |
def run_once(self, subtest='None'): |
logging.info("Running TPM firmware client subtest %s", subtest) |
- if (subtest == 'setup'): |
- self.tpm_setup() |
- self.tpm_write_status(0) |
- elif (subtest == 'takeownership'): |
- self.tpm_setup(with_tcsd=True) |
- own_cmd = os.path.join(self.bindir, "tpm_takeownership -y -z") |
- self.tpm_run(own_cmd) |
- else: |
- self.tpm_setup() |
+ if (subtest == 'takeownership'): |
+ output = utils.run("start tcsd", ignore_status=False) |
+ # When TCSD is running, the system might try to take ownership as |
+ # well. We don't care. |
+ logging.info(output) |
+ own_cmd = "tpm_takeownership -y -z" |
+ self.tpm_run(own_cmd, ignore_status=True) |
+ else: |
cmd = os.path.join(self.srcdir, subtest) |
self.tpm_run(cmd, ignore_status=True) |