attest: remove Log statements from tests (#81)

Tests generally shouldn't print anything unless they fail.
This commit is contained in:
Eric Chiang 2019-08-21 10:28:55 -07:00 committed by Tom D
parent 9b6caf1273
commit 78755e7a91

View File

@ -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)
} }