Skip to content

Commit 3ae9e95

Browse files
rscgopherbot
authored andcommitted
cmd/go: fix TestCgoPkgConfig on darwin with pkg-config installed
Most darwin systems don't have pkg-config installed and skip this test. (And it doesn't run in all.bash because it is skipped during -short.) But for those systems that have pkg-config and run the non-short tests, it fails because the code was not writing out the bar.pc on darwin and then expecting pkg-config to be able to tell us about the bar package. Change the code to write out the bar entry always. Fixes one failing case in 'go test cmd/go' on my Mac. Change-Id: Ibc4e9826a652ce2e7c609b905b159ccf2d5a6444 Reviewed-on: https://go-review.googlesource.com/c/go/+/718182 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> Auto-Submit: Russ Cox <rsc@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent a494a26 commit 3ae9e95

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/cmd/go/go_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,15 +1506,17 @@ func main() {
15061506
tg.setenv("PKG_CONFIG_PATH", tg.path("."))
15071507
tg.run("run", tg.path("foo.go"))
15081508

1509-
if runtime.GOOS != "darwin" { // darwin doesn't like these ldflags
1510-
// test for ldflags
1511-
tg.tempFile("bar.pc", `
1509+
libs := `Libs: -Wl,-rpath=/path\ with\ spaces/bin`
1510+
if runtime.GOOS == "darwin" {
1511+
libs = "" // darwin linker doesn't have -rpath
1512+
}
1513+
// test for ldflags
1514+
tg.tempFile("bar.pc", `
15121515
Name: bar
15131516
Description: The bar library
15141517
Version: 1.0.0
1515-
Libs: -Wl,-rpath=/path\ with\ spaces/bin
1518+
`+libs+`
15161519
`)
1517-
}
15181520

15191521
tg.tempFile("bar.go", `package main
15201522
/*

0 commit comments

Comments
 (0)