Skip to content

Commit 2ff9e01

Browse files
committed
cmd/link: fix TestDWARFiOS
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 <[email protected]> Run-TryBot: Cherry Zhang <[email protected]> Reviewed-by: Jeremy Faller <[email protected]> Reviewed-by: Than McIntosh <[email protected]>
1 parent 0040adf commit 2ff9e01

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/cmd/link/dwarf_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,18 @@ func TestDWARFiOS(t *testing.T) {
195195
}
196196
// Check to see if the ios tools are installed. It's possible to have the command line tools
197197
// installed without the iOS sdk.
198-
if output, err := exec.Command("xcodebuild -showsdks").CombinedOutput(); err != nil {
198+
if output, err := exec.Command("xcodebuild", "-showsdks").CombinedOutput(); err != nil {
199199
t.Skipf("error running xcodebuild, required for iOS cross build: %v", err)
200200
} else if !strings.Contains(string(output), "iOS SDK") {
201201
t.Skipf("iOS SDK not detected.")
202202
}
203203
cc := "CC=" + runtime.GOROOT() + "/misc/ios/clangwrap.sh"
204204
// iOS doesn't allow unmapped segments, so iOS executables don't have DWARF.
205-
testDWARF(t, "", false, cc, "CGO_ENABLED=1", "GOOS=darwin", "GOARCH=arm64")
205+
t.Run("exe", func(t *testing.T) {
206+
testDWARF(t, "", false, cc, "CGO_ENABLED=1", "GOOS=ios", "GOARCH=arm64")
207+
})
206208
// However, c-archive iOS objects have embedded DWARF.
207-
testDWARF(t, "c-archive", true, cc, "CGO_ENABLED=1", "GOOS=darwin", "GOARCH=arm64")
209+
t.Run("c-archive", func(t *testing.T) {
210+
testDWARF(t, "c-archive", true, cc, "CGO_ENABLED=1", "GOOS=ios", "GOARCH=arm64")
211+
})
208212
}

0 commit comments

Comments
 (0)