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
This commit is contained in:
Nehal J Wani 2021-01-25 11:28:34 -05:00
parent 54b251f542
commit f8fe9afad5
No known key found for this signature in database
GPG key ID: 87F40C1A586E6978

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")
}