]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: fix TestDWARFiOS
authorCherry Zhang <cherryyz@google.com>
Sat, 17 Oct 2020 01:42:01 +0000 (21:42 -0400)
committerCherry Zhang <cherryyz@google.com>
Mon, 19 Oct 2020 18:31:39 +0000 (18:31 +0000)
Use GOOS=ios.

Run "xcodebuild -showsdks" correctly.

Wrap testDWARF in subtests, as it calls t.Parallel, otherwise
the two calls of testDWARF will cause t.Parallel being called
twice, which panics.

Updates #38485.

Change-Id: I614c8daa99c83cbfd05a4cfa041968d49279f16a
Reviewed-on: https://go-review.googlesource.com/c/go/+/263639
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Jeremy Faller <jeremy@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/link/dwarf_test.go

index 88480064dd114c82ce4daae1645ce78a18727376..db710bed6ab0621a014e6be58a7cdd0fa93309a6 100644 (file)
@@ -195,14 +195,18 @@ func TestDWARFiOS(t *testing.T) {
        }
        // Check to see if the ios tools are installed. It's possible to have the command line tools
        // installed without the iOS sdk.
-       if output, err := exec.Command("xcodebuild -showsdks").CombinedOutput(); err != nil {
+       if output, err := exec.Command("xcodebuild", "-showsdks").CombinedOutput(); err != nil {
                t.Skipf("error running xcodebuild, required for iOS cross build: %v", err)
        } else if !strings.Contains(string(output), "iOS SDK") {
                t.Skipf("iOS SDK not detected.")
        }
        cc := "CC=" + runtime.GOROOT() + "/misc/ios/clangwrap.sh"
        // iOS doesn't allow unmapped segments, so iOS executables don't have DWARF.
-       testDWARF(t, "", false, cc, "CGO_ENABLED=1", "GOOS=darwin", "GOARCH=arm64")
+       t.Run("exe", func(t *testing.T) {
+               testDWARF(t, "", false, cc, "CGO_ENABLED=1", "GOOS=ios", "GOARCH=arm64")
+       })
        // However, c-archive iOS objects have embedded DWARF.
-       testDWARF(t, "c-archive", true, cc, "CGO_ENABLED=1", "GOOS=darwin", "GOARCH=arm64")
+       t.Run("c-archive", func(t *testing.T) {
+               testDWARF(t, "c-archive", true, cc, "CGO_ENABLED=1", "GOOS=ios", "GOARCH=arm64")
+       })
 }