Skip running the UDS lisafs test for runsc/fsgofer.

In some test environments, the `TEST_TMPDIR` path is too long.
So creating a socket file inside that via bind(2) fails with EINVAL.
bind(2) requires paths to be shorter than 108.

PiperOrigin-RevId: 609110892
This commit is contained in:
Ayush Ranjan
2024-02-21 13:54:19 -08:00
committed by gVisor bot
parent 9e2fc019a6
commit 1303df5f70
3 changed files with 14 additions and 3 deletions
+6
View File
@@ -46,6 +46,9 @@ type Tester interface {
// SetUserGroupIDSupported returns true if the backing server supports
// changing UID/GID for files.
SetUserGroupIDSupported() bool
// BindSupported returns true if the backing server supports BindAt.
BindSupported() bool
}
// RunAllLocalFSTests runs all local FS tests as subtests.
@@ -606,6 +609,9 @@ func testMknod(ctx context.Context, t *testing.T, tester Tester, root lisafs.Cli
}
func testUDS(ctx context.Context, t *testing.T, tester Tester, root lisafs.ClientFD) {
if !tester.BindSupported() {
t.Skipf("server does not support BindAt RPC")
}
const name = "sock"
file, socket, stat := bind(ctx, t, root, name, unix.SOCK_STREAM)
defer closeFD(ctx, t, file)
-1
View File
@@ -34,6 +34,5 @@ go_test(
"//pkg/lisafs",
"//pkg/lisafs/testsuite",
"//pkg/log",
"//runsc/config",
],
)
+8 -2
View File
@@ -20,7 +20,6 @@ import (
"gvisor.dev/gvisor/pkg/lisafs"
"gvisor.dev/gvisor/pkg/lisafs/testsuite"
"gvisor.dev/gvisor/pkg/log"
"gvisor.dev/gvisor/runsc/config"
"gvisor.dev/gvisor/runsc/fsgofer"
)
@@ -39,7 +38,7 @@ type tester struct{}
// NewServer implements testsuite.Tester.NewServer.
func (tester) NewServer(t *testing.T) *lisafs.Server {
return &fsgofer.NewLisafsServer(fsgofer.Config{HostUDS: config.HostUDSCreate}).Server
return &fsgofer.NewLisafsServer(fsgofer.Config{}).Server
}
// LinkSupported implements testsuite.Tester.LinkSupported.
@@ -52,6 +51,13 @@ func (tester) SetUserGroupIDSupported() bool {
return true
}
// BindSupported implements testsuite.Tester.BindSupported.
func (tester) BindSupported() bool {
// In some test environments, the mount path is really large and bind(2)
// fails with EINVAL if the path length >= 108.
return false
}
func TestFSGofer(t *testing.T) {
testsuite.RunAllLocalFSTests(t, tester{})
}