cmd/dist: refine test conditions and enable more cgo tests on Android, iOS

This CL moves many cgo test conditions out of dist and into the tests
themselves, now that they can use the testenv.Must* helpers.

This refines a lot of the conditions, which happens to have the effect
of enabling many tests on Android and iOS that are disabled by
too-coarse GOOS checks in dist today.

Fixes #15919.

Change-Id: I2947526b08928d2f7f89f107b5b2403b32092ed8
Reviewed-on: https://go-review.googlesource.com/c/go/+/495918
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
Austin Clements 2023-04-26 12:16:26 -04:00
parent 071770b846
commit a674ab1961
24 changed files with 197 additions and 148 deletions

View file

@ -6,6 +6,8 @@ package errorstest
import (
"bytes"
"cmd/internal/quoted"
"internal/testenv"
"os"
"os/exec"
"path/filepath"
@ -39,6 +41,9 @@ func main() {
`
func TestBadSymbol(t *testing.T) {
testenv.MustHaveGoBuild(t)
testenv.MustHaveCGO(t)
dir := t.TempDir()
mkdir := func(base string) string {
@ -167,7 +172,14 @@ func TestBadSymbol(t *testing.T) {
}
func cCompilerCmd(t *testing.T) []string {
cc := []string{goEnv(t, "CC")}
cc, err := quoted.Split(goEnv(t, "CC"))
if err != nil {
t.Skipf("parsing go env CC: %s", err)
}
if len(cc) == 0 {
t.Skipf("no C compiler")
}
testenv.MustHaveExecPath(t, cc[0])
out := goEnv(t, "GOGCCFLAGS")
quote := '\000'