1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:20:23 -07:00

cmd/link: disable TestPIESize if CGO isn't enabled

With CGO disabled, the test throws the following error:

elf_test.go:291: # command-line-arguments
    loadinternal: cannot find runtime/cgo

Change-Id: Iaeb183562ab637c714240b49e73078bdb791b35b
GitHub-Last-Rev: f8fe9afad5
GitHub-Pull-Request: golang/go#43911
Reviewed-on: https://go-review.googlesource.com/c/go/+/286632
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Nehal J Wani 2021-01-26 16:29:05 +00:00 committed by Cherry Zhang
parent 6ac91e460c
commit 26e29aa15a

View File

@ -226,6 +226,12 @@ func main() {
func TestPIESize(t *testing.T) {
testenv.MustHaveGoBuild(t)
// We don't want to test -linkmode=external if cgo is not supported.
// On some systems -buildmode=pie implies -linkmode=external, so just
// always skip the test if cgo is not supported.
testenv.MustHaveCGO(t)
if !sys.BuildModeSupported(runtime.Compiler, "pie", runtime.GOOS, runtime.GOARCH) {
t.Skip("-buildmode=pie not supported")
}