diff options
| author | Dmitri Shuralyov <dmitshur@golang.org> | 2023-07-27 19:36:55 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2023-07-28 21:31:41 +0000 |
| commit | 2ad666dea0490305bb7fd2dd6e7beb767acfd2c3 (patch) | |
| tree | 4f94fe90b3b2f4bfa33d0e7251a1c9598db73549 /src/cmd/cgo/internal | |
| parent | f322d67ced53f413c4b35f41f754fa34f440b012 (diff) | |
| download | go-2ad666dea0490305bb7fd2dd6e7beb767acfd2c3.tar.xz | |
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 <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/cgo/internal')
| -rw-r--r-- | src/cmd/cgo/internal/test/issue1435.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd/cgo/internal/test/issue1435.go b/src/cmd/cgo/internal/test/issue1435.go index a672e26aa0..1588d39ea9 100644 --- a/src/cmd/cgo/internal/test/issue1435.go +++ b/src/cmd/cgo/internal/test/issue1435.go @@ -8,6 +8,7 @@ package cgotest import ( "fmt" + "internal/testenv" "os" "runtime" "sort" @@ -145,6 +146,13 @@ func test1435(t *testing.T) { if syscall.Getuid() != 0 { t.Skip("skipping root only test") } + if testing.Short() && testenv.Builder() != "" && os.Getenv("USER") == "swarming" { + // The Go build system's swarming user is known not to be root. + // Unfortunately, it sometimes appears as root due the current + // implementation of a no-network check using 'unshare -n -r'. + // Since this test does need root to work, we need to skip it. + t.Skip("skipping root only test on a non-root builder") + } if runtime.GOOS == "linux" { if _, err := os.Stat("/etc/alpine-release"); err == nil { t.Skip("skipping failing test on alpine - go.dev/issue/19938") |
