]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: unskip TestBuildForTvOS on dwarin/arm64
authorCherry Mui <cherryyz@google.com>
Thu, 28 Sep 2023 02:13:58 +0000 (22:13 -0400)
committerCherry Mui <cherryyz@google.com>
Thu, 28 Sep 2023 15:31:13 +0000 (15:31 +0000)
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 <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>

src/cmd/link/link_test.go

index 522e5a4c166778781a1554b9af73b9f83dd7bb4f..897607c4fad5e06f5af410fbf9f6b23e15502cfc 100644 (file)
@@ -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)
        }