misc/cgo/test: disable setgid tests with musl

We don't have a good musl detection mechanism, so we detect Alpine (the
most common user of musl) instead.

For #39857.
For #19938.

Change-Id: I2fa39248682aed75884476374fe2212be4427347
Reviewed-on: https://go-review.googlesource.com/c/go/+/425001
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Pratt 2022-08-19 17:38:00 -04:00 committed by Gopher Robot
parent 761db3e7f0
commit 6bdca82030
1 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,7 @@
package cgotest package cgotest
import ( import (
"os"
"runtime" "runtime"
"testing" "testing"
) )
@ -13,6 +14,9 @@ func TestSetgid(t *testing.T) {
if runtime.GOOS == "android" { if runtime.GOOS == "android" {
t.Skip("unsupported on Android") t.Skip("unsupported on Android")
} }
if _, err := os.Stat("/etc/alpine-release"); err == nil {
t.Skip("setgid is broken with musl libc - go.dev/issue/39857")
}
testSetgid(t) testSetgid(t)
} }
@ -20,6 +24,9 @@ func TestSetgidStress(t *testing.T) {
if runtime.GOOS == "android" { if runtime.GOOS == "android" {
t.Skip("unsupported on Android") t.Skip("unsupported on Android")
} }
if _, err := os.Stat("/etc/alpine-release"); err == nil {
t.Skip("setgid is broken with musl libc - go.dev/issue/39857")
}
testSetgidStress(t) testSetgidStress(t)
} }