mirror of
https://github.com/golang/go
synced 2024-11-14 05:30:21 -07:00
syscall: skip TestSetuidEtc when root's gid is not 0
When the root user belongs to a special user group
(for example, in a mock environment), TestSetuidEtc will fail.
For example: Setegid(1)
want:"Gid: 0 1 0 1"
got:"Gid: 1001 1 1001 1"
Fixes #69921
Change-Id: I74d0a006b7529b1b569120a067eb4d7c4ed2e491
GitHub-Last-Rev: 5724383eb1
GitHub-Pull-Request: golang/go#69922
Reviewed-on: https://go-review.googlesource.com/c/go/+/620775
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
c1d9303d82
commit
0492d936c5
@ -499,6 +499,9 @@ func TestSetuidEtc(t *testing.T) {
|
||||
if syscall.Getuid() != 0 {
|
||||
t.Skip("skipping root only test")
|
||||
}
|
||||
if syscall.Getgid() != 0 {
|
||||
t.Skip("skipping the test when root's gid is not default value 0")
|
||||
}
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user