Files
mesh-controller/vendor/github.com/google/go-tpm/legacy/tpm2
jochen be92762969 Give every test a bus of its own, at the release the mesh runs (hq ADR 0237)
The live tests reached one shared bus and assert, read and remove the mesh's own objects by
their fixed names, so packages run in parallel deleted what each other read and the suite
passed only one package at a time; a red suite read as noise. internal/testbus starts a server
per test, linked in at the nats-server release go.mod pins, and a test holds that pin to the
catalogue's bus image and to the facts snapshot's bus when there is one, so the tests never run
a bus the mesh does not. The waiter test read a timing (the most connections held at one look)
and now reads the state it means (the fewest held across the wait). make check runs the packages
in parallel under the race detector, with a timeout.
2026-10-06 21:17:02 +02:00
..

TPM 2.0 client library

Tests

This library contains unit tests in github.com/google/go-tpm/tpm2, which just tests that various encoding and error checking functions work correctly. It also contains more comprehensive integration tests in github.com/google/go-tpm/tpm2/test, which run actual commands on a TPM.

By default, these integration tests are run against the go-tpm-tools simulator, which is baesed on the Microsoft Reference TPM2 code. To run both the unit and integration tests, run (in this directory)

go test . ./test

These integration tests can also be run against a real TPM device. This is slightly more complex as the tests often need to be built as a normal user and then executed as root. For example,

# Build the test binary without running it
go test -c github.com/google/go-tpm/tpm2/test
# Execute the test binary as root
sudo ./test.test --tpm-path=/dev/tpmrm0

On Linux, The --tpm-path causes the integration tests to be run against a real TPM located at that path (usually /dev/tpmrm0 or /dev/tpm0). On Windows, the story is similar, execept that the --use-tbs flag is used instead.

Tip: if your TPM host is remote and you don't want to install Go on it, this same two-step process can be used. The test binary can be copied to a remote host and run without extra installation (as the test binary has very few runtime dependancies).