File: linuxtpm_test.go

package info (click to toggle)
golang-github-google-go-tpm 0.9.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,932 kB
  • sloc: makefile: 13
file content (25 lines) | stat: -rw-r--r-- 604 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//go:build !windows

package linuxtpm

import (
	"os"
	"testing"

	"github.com/google/go-tpm/tpm2/transport"
	testhelper "github.com/google/go-tpm/tpm2/transport/test"
)

func open(path string) func() (transport.TPMCloser, error) {
	return func() (transport.TPMCloser, error) {
		return Open(path)
	}
}

func TestLocalTPM(t *testing.T) {
	testhelper.RunTest(t, []error{os.ErrNotExist, os.ErrPermission, ErrFileIsNotDevice}, open("/dev/tpm0"))
}

func TestLocalResourceManagedTPM(t *testing.T) {
	testhelper.RunTest(t, []error{os.ErrNotExist, os.ErrPermission, ErrFileIsNotDevice}, open("/dev/tpmrm0"))
}