From 9d3cc85e51d8285556b818a44dce0fce94f261fe Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Wed, 27 Sep 2023 22:13:58 -0400 Subject: [PATCH] cmd/link: unskip TestBuildForTvOS on dwarin/arm64 TestBuildForTvOS currently runs only on darwin/amd64. It can also run on darwin/arm64, if the SDK is installed. Unskip the test. Also add logging for the build commands it runs. For #63203. Change-Id: Id41d2e1879f5d39d239f0586d836d33accf5efbf Reviewed-on: https://go-review.googlesource.com/c/go/+/531555 Reviewed-by: Than McIntosh Run-TryBot: Cherry Mui TryBot-Result: Gopher Robot --- src/cmd/link/link_test.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index 522e5a4c16..897607c4fa 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -267,9 +267,9 @@ func TestBuildForTvOS(t *testing.T) { testenv.MustHaveCGO(t) testenv.MustHaveGoBuild(t) - // Only run this on darwin/amd64, where we can cross build for tvOS. - if runtime.GOARCH != "amd64" || runtime.GOOS != "darwin" { - t.Skip("skipping on non-darwin/amd64 platform") + // Only run this on darwin, where we can cross build for tvOS. + if runtime.GOOS != "darwin" { + t.Skip("skipping on non-darwin platform") } if testing.Short() && os.Getenv("GO_BUILDER_NAME") == "" { t.Skip("skipping in -short mode with $GO_BUILDER_NAME empty") @@ -298,14 +298,16 @@ func TestBuildForTvOS(t *testing.T) { ar := filepath.Join(tmpDir, "lib.a") cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-buildmode=c-archive", "-o", ar, lib) - cmd.Env = append(os.Environ(), + env := []string{ "CGO_ENABLED=1", "GOOS=ios", "GOARCH=arm64", - "CC="+strings.Join(CC, " "), + "CC=" + strings.Join(CC, " "), "CGO_CFLAGS=", // ensure CGO_CFLAGS does not contain any flags. Issue #35459 - "CGO_LDFLAGS="+strings.Join(CGO_LDFLAGS, " "), - ) + "CGO_LDFLAGS=" + strings.Join(CGO_LDFLAGS, " "), + } + cmd.Env = append(os.Environ(), env...) + t.Logf("%q %v", env, cmd) if out, err := cmd.CombinedOutput(); err != nil { t.Fatalf("%v: %v:\n%s", cmd.Args, err, out) } @@ -314,6 +316,7 @@ func TestBuildForTvOS(t *testing.T) { link.Args = append(link.Args, CGO_LDFLAGS...) link.Args = append(link.Args, "-o", filepath.Join(tmpDir, "a.out")) // Avoid writing to package directory. link.Args = append(link.Args, ar, filepath.Join("testdata", "testBuildFortvOS", "main.m")) + t.Log(link) if out, err := link.CombinedOutput(); err != nil { t.Fatalf("%v: %v:\n%s", link.Args, err, out) }