diff --git a/kola/tests/misc/tpm.go b/kola/tests/misc/tpm.go index d1e5a51c6..cfebdd878 100644 --- a/kola/tests/misc/tpm.go +++ b/kola/tests/misc/tpm.go @@ -302,6 +302,15 @@ func init() { Distros: []string{"cl"}, MinVersion: semver.Version{Major: 3913, Minor: 0, Patch: 1}, }) + + register.Register(®ister.Test{ + Run: eventLogTest, + ClusterSize: 0, + Platforms: []string{"qemu"}, + Name: "cl.tpm.eventlog", + Distros: []string{"cl"}, + MinVersion: semver.Version{Major: 4082}, + }) } func tpmTest(c cluster.TestCluster, userData *conf.UserData, mountpoint string, variant string) { @@ -359,3 +368,27 @@ func tpmTest(c cluster.TestCluster, userData *conf.UserData, mountpoint string, checkIfMountpointIsEncrypted(c, m, "/") } } + +func eventLogTest(c cluster.TestCluster) { + options := platform.MachineOptions{EnableTPM: true} + var ( + m platform.Machine + err error + ) + switch pc := c.Cluster.(type) { + // These cases have to be separated because otherwise the golang compiler doesn't type-check + // the case bodies using the proper subtype of `pc`. + case *qemu.Cluster: + m, err = pc.NewMachineWithOptions(nil, options) + case *unprivqemu.Cluster: + m, err = pc.NewMachineWithOptions(nil, options) + default: + c.Fatal("unknown cluster type") + } + if err != nil { + c.Fatal(err) + } + + // Verify that the TPM event log is working. + _ = c.MustSSH(m, "sudo tpm2_eventlog /sys/kernel/security/tpm0/binary_bios_measurements") +} diff --git a/platform/machine/unprivqemu/flight.go b/platform/machine/unprivqemu/flight.go index 1743eee5b..8035a6e8f 100644 --- a/platform/machine/unprivqemu/flight.go +++ b/platform/machine/unprivqemu/flight.go @@ -81,6 +81,7 @@ func (qf *flight) NewCluster(rconf *platform.RuntimeConfig) (platform.Cluster, e } func (qf *flight) Destroy() { + qf.BaseFlight.Destroy() if qf.diskImageFile != nil { qf.diskImageFile.Close() }