test

package
v0.3.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2021 License: Apache-2.0, BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package test provides helper methods for testing. It should never be included in non-test libraries/binaries.

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed eventlogs/arch-linux-workstation.bin
	ArchLinuxWorkstationEventLog []byte
	//go:embed eventlogs/debian-10.bin
	Debian10EventLog []byte
	//go:embed eventlogs/glinux-alex.bin
	GlinuxAlexEventLog []byte
	//go:embed eventlogs/rhel8-uefi.bin
	Rhel8EventLog []byte
	//go:embed eventlogs/ubuntu-2104-no-dbx.bin
	Ubuntu2104NoDbxEventLog []byte
	//go:embed eventlogs/ubuntu-2104-no-secure-boot.bin
	Ubuntu2104NoSecureBootEventLog []byte
)

Raw binary TCG Event Logs

View Source
var (
	DebugPCR       = 16
	ApplicationPCR = 23
)

PCR registers that are OK to use in tests (can be reset without reboot)

Functions

func GetTPM

func GetTPM(tb testing.TB) io.ReadWriteCloser

GetTPM is a cross-platform testing helper function that retrives the appropriate TPM device from the flags passed into "go test".

If using a test TPM, this will also retrieve a test eventlog. In this case, GetTPM extends the test event log's events into the test TPM.

func LoadRandomExternalKey

func LoadRandomExternalKey(tb testing.TB, rw io.ReadWriter) tpmutil.Handle

LoadRandomExternalKey loads a randomly generated external key into the TPM simulator and returns its' handle. If any errors occur, calls Fatal() on the passed testing.TB.

func SkipOnUnsupportedAlg

func SkipOnUnsupportedAlg(t testing.TB, rw io.ReadWriter, alg tpm2.Algorithm)

SkipOnUnsupportedAlg skips the test if the algorithm is not found in the TPM capability.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL