import "gvisor.dev/gvisor/pkg/p9/p9test"
Package p9test provides standard mocks for p9.
MakePath returns a globally unique path.
Generator is a function that generates a new file.
type Harness struct { Attacher *MockAttacher // contains filtered or unexported fields }
Harness is an attacher mock.
NewHarness creates and returns a new test server.
It should always be used as:
h, c := NewHarness(t) defer h.Finish()
Finish completes all checks and shuts down the server.
NewBlockDevice returns a new mock block device.
NewCharacterDevice returns a new mock character device.
NewDirectory returns a new mock directory.
Note that Mkdir, Link, Mknod, RenameAt, UnlinkAt and Readdir must be mocked separately. Walk is provided and children may be manipulated via AddChild and RemoveChild. After calling Walk remotely, one can use Pop to find the corresponding backend mock on the server side.
NewFile returns a new file mock.
Note that ReadAt and WriteAt must be mocked separately.
NewMock returns a new base file.
NewNamedPipe returns a new mock named pipe.
NewSocket returns a new mock socket.
NewSymlink returns a new mock directory.
Note that Readlink must be mocked separately.
Pop pops off the most recently created Mock and assert that this mock represents the same file passed in. If nil is passed in, no check is performed.
Precondition: there must be at least one Mock or this will panic.
type Mock struct { p9.DefaultWalkGetAttr *MockFile QID p9.QID Attr p9.Attr // WalkCallback is a special function that will be called from within // the walk context. This is needed for the concurrent tests within // this package. WalkCallback func() error // contains filtered or unexported fields }
Mock is a common mock element.
AddChild adds a new child to the Mock.
GetAttr returns the current attributes.
Matches implements gomock.Matcher.Matches.
RemoveChild removes the child with the given name.
String implements gomock.Matcher.String.
Walk supports clone and walking in directories.
WalkGetAttr calls the default implementation; this is a client-side optimization.
Package p9test imports 8 packages (graph). Updated 2020-12-31. Refresh now. Tools for package owners.