From 2ad666dea0490305bb7fd2dd6e7beb767acfd2c3 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Thu, 27 Jul 2023 19:36:55 -0400 Subject: syscall, cmd/cgo: skip tests that shouldn't run under 'unshare -n -r' A small number of tests in the main tree are currently skipped in LUCI because our builders there run tests without root. Unfortunately, these tests begin to run when run under 'unshare -n -r' as implemented in the current iteration of a no-network check. Add targeted builder-only skips so that they don't begin to run and fail with a false positive. Updates #10719. For #30612. Change-Id: I6dd320714a279c395882c1b2ebfbb2fce58f913b Reviewed-on: https://go-review.googlesource.com/c/go/+/513779 Run-TryBot: Dmitri Shuralyov Auto-Submit: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Heschi Kreinick TryBot-Result: Gopher Robot --- src/syscall/exec_linux_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/syscall/exec_linux_test.go') diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index e9919b6801..f894bbaae9 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -249,6 +249,14 @@ func TestUnshareMountNameSpace(t *testing.T) { if testenv.SyscallIsNotSupported(err) { t.Skipf("skipping: could not start process with CLONE_NEWNS: %v", err) } + if testing.Short() && testenv.Builder() != "" && os.Getenv("USER") == "swarming" { + // The Go build system's swarming user is known not to support + // starting a process with CLONE_NEWNS. + // Unfortunately, it doesn't get recognized as such due the current + // implementation of a no-network check using 'unshare -n -r'. + // Since this test does need start this process, we need to skip it. + t.Skipf("skipping: could not start process with CLONE_NEWNS: %v", err) + } t.Fatalf("unshare failed: %v\n%s", err, o) } @@ -301,6 +309,14 @@ func TestUnshareMountNameSpaceChroot(t *testing.T) { if testenv.SyscallIsNotSupported(err) { t.Skipf("skipping: could not start process with CLONE_NEWNS and Chroot %q: %v", d, err) } + if testing.Short() && testenv.Builder() != "" && os.Getenv("USER") == "swarming" { + // The Go build system's swarming user is known not to support + // starting a process with CLONE_NEWNS and Chroot. + // Unfortunately, it doesn't get recognized as such due the current + // implementation of a no-network check using 'unshare -n -r'. + // Since this test does need start this process, we need to skip it. + t.Skipf("skipping: could not start process with CLONE_NEWNS and Chroot %q: %v", d, err) + } t.Fatalf("unshare failed: %v\n%s", err, o) } -- cgit v1.3