mirror of
https://github.com/google/go-attestation.git
synced 2025-01-31 07:55:22 +00:00
attest: remove Log statements from tests (#81)
Tests generally shouldn't print anything unless they fail.
This commit is contained in:
parent
9b6caf1273
commit
78755e7a91
@ -55,12 +55,9 @@ func TestSimTPM20Info(t *testing.T) {
|
|||||||
sim, tpm := setupSimulatedTPM(t)
|
sim, tpm := setupSimulatedTPM(t)
|
||||||
defer sim.Close()
|
defer sim.Close()
|
||||||
|
|
||||||
info, err := tpm.Info()
|
if _, err := tpm.Info(); err != nil {
|
||||||
if err != nil {
|
|
||||||
t.Errorf("tpm.Info() failed: %v", err)
|
t.Errorf("tpm.Info() failed: %v", err)
|
||||||
}
|
}
|
||||||
// We dont expect anything to be meaningfully populated as this is a simulator.
|
|
||||||
t.Logf("TPM Info = %+v", info)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSimTPM20AIKCreateAndLoad(t *testing.T) {
|
func TestSimTPM20AIKCreateAndLoad(t *testing.T) {
|
||||||
@ -198,20 +195,15 @@ func TestSimTPM20Persistence(t *testing.T) {
|
|||||||
sim, tpm := setupSimulatedTPM(t)
|
sim, tpm := setupSimulatedTPM(t)
|
||||||
defer sim.Close()
|
defer sim.Close()
|
||||||
|
|
||||||
ekHnd, p, err := tpm.getPrimaryKeyHandle(commonEkEquivalentHandle)
|
ekHnd, _, err := tpm.getPrimaryKeyHandle(commonEkEquivalentHandle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("getPrimaryKeyHandle() failed: %v", err)
|
t.Fatalf("getPrimaryKeyHandle() failed: %v", err)
|
||||||
}
|
}
|
||||||
if ekHnd != commonEkEquivalentHandle {
|
if ekHnd != commonEkEquivalentHandle {
|
||||||
t.Fatalf("bad EK-equivalent handle: got 0x%x, wanted 0x%x", ekHnd, commonEkEquivalentHandle)
|
t.Fatalf("bad EK-equivalent handle: got 0x%x, wanted 0x%x", ekHnd, commonEkEquivalentHandle)
|
||||||
}
|
}
|
||||||
if p {
|
|
||||||
t.Logf("generated a new key")
|
|
||||||
} else {
|
|
||||||
t.Logf("used existing key")
|
|
||||||
}
|
|
||||||
|
|
||||||
ekHnd, p, err = tpm.getPrimaryKeyHandle(commonEkEquivalentHandle)
|
ekHnd, p, err := tpm.getPrimaryKeyHandle(commonEkEquivalentHandle)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("second getPrimaryKeyHandle() failed: %v", err)
|
t.Fatalf("second getPrimaryKeyHandle() failed: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user