MCPcopy
hub / github.com/google/gvisor / runTest

Function runTest

pkg/sentry/kernel/pipe/pipe_test.go:29–47  ·  view source on GitHub ↗
(t *testing.T, sizeBytes int64, tester func(ctx context.Context, r, w *vfs.FileDescription))

Source from the content-addressed store, hash-verified

27)
28
29func runTest(t *testing.T, sizeBytes int64, tester func(ctx context.Context, r, w *vfs.FileDescription)) {
30 ctx := contexttest.Context(t)
31 vfsObj := &vfs.VirtualFilesystem{}
32 if err := vfsObj.Init(ctx); err != nil {
33 t.Fatalf("VFS init: %v", err)
34 }
35 vd := vfsObj.NewAnonVirtualDentry("pipe")
36 defer vd.DecRef(ctx)
37
38 vp := NewVFSPipe(false /* isNamed */, sizeBytes)
39 r, w, err := vp.ReaderWriterPair(ctx, vd.Mount(), vd.Dentry(), 0)
40 if err != nil {
41 t.Fatalf("ReaderWriterPair failed: %v", err)
42 }
43 defer r.DecRef(ctx)
44 defer w.DecRef(ctx)
45
46 tester(ctx, r, w)
47}
48
49func TestPipeRW(t *testing.T) {
50 runTest(t, 65536, func(ctx context.Context, r *vfs.FileDescription, w *vfs.FileDescription) {

Callers 4

TestPipeRWFunction · 0.70
TestPipeReadBlockFunction · 0.70
TestPipeWriteBlockFunction · 0.70
TestPipeWriteUntilEndFunction · 0.70

Calls 10

InitMethod · 0.95
NewAnonVirtualDentryMethod · 0.95
ReaderWriterPairMethod · 0.95
ContextFunction · 0.92
NewVFSPipeFunction · 0.85
testerStruct · 0.85
FatalfMethod · 0.65
DecRefMethod · 0.65
MountMethod · 0.65
DentryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…