From 1303df5f706e7cd7efa99f242830f5024ae25c5b Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Wed, 21 Feb 2024 13:50:17 -0800 Subject: [PATCH] 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 --- pkg/lisafs/testsuite/testsuite.go | 6 ++++++ runsc/fsgofer/BUILD | 1 - runsc/fsgofer/lisafs_test.go | 10 ++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/lisafs/testsuite/testsuite.go b/pkg/lisafs/testsuite/testsuite.go index b34f923ca..570471369 100644 --- a/pkg/lisafs/testsuite/testsuite.go +++ b/pkg/lisafs/testsuite/testsuite.go @@ -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) diff --git a/runsc/fsgofer/BUILD b/runsc/fsgofer/BUILD index eeb326e20..c3b00f802 100644 --- a/runsc/fsgofer/BUILD +++ b/runsc/fsgofer/BUILD @@ -34,6 +34,5 @@ go_test( "//pkg/lisafs", "//pkg/lisafs/testsuite", "//pkg/log", - "//runsc/config", ], ) diff --git a/runsc/fsgofer/lisafs_test.go b/runsc/fsgofer/lisafs_test.go index bfa2c1880..d37c84e97 100644 --- a/runsc/fsgofer/lisafs_test.go +++ b/runsc/fsgofer/lisafs_test.go @@ -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{}) }