| 1 |
//go:build !windows |
| 2 |
|
| 3 |
package linuxtpm |
| 4 |
|
| 5 |
import ( |
| 6 |
"os" |
| 7 |
"testing" |
| 8 |
|
| 9 |
"github.com/google/go-tpm/tpm2/transport" |
| 10 |
testhelper "github.com/google/go-tpm/tpm2/transport/test" |
| 11 |
) |
| 12 |
|
| 13 |
func open(path string) func() (transport.TPMCloser, error) { |
| 14 |
return func() (transport.TPMCloser, error) { |
| 15 |
return Open(path) |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
func TestLocalTPM(t *testing.T) { |
| 20 |
testhelper.RunTest(t, []error{os.ErrNotExist, os.ErrPermission, ErrFileIsNotDevice}, open("/dev/tpm0")) |
| 21 |
} |
| 22 |
|
| 23 |
func TestLocalResourceManagedTPM(t *testing.T) { |
| 24 |
testhelper.RunTest(t, []error{os.ErrNotExist, os.ErrPermission, ErrFileIsNotDevice}, open("/dev/tpmrm0")) |
| 25 |
} |