From: Bryan C. Mills Date: Thu, 17 Nov 2022 01:24:03 +0000 (-0500) Subject: cmd/fix: allow cgo commands in tests to fail if 'go build' is not supported X-Git-Tag: go1.20rc1~197 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3f5b02d09f0d345c2d6bef83eddbd518e9327276;p=gostls13.git cmd/fix: allow cgo commands in tests to fail if 'go build' is not supported testenv.HasCgo reports whether the test binary may have been built with cgo enabled, but having been built with cgo does not necessarily imply that the test can invoke the cgo tool itself. This should fix a test failure on the android builders introduced in CL 450714. Change-Id: I2eed4098736e1cb285ca20bc248b0ab3515f0dea Reviewed-on: https://go-review.googlesource.com/c/go/+/451221 Auto-Submit: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor Run-TryBot: Bryan Mills --- diff --git a/src/cmd/fix/main_test.go b/src/cmd/fix/main_test.go index 837a5d72c7..2b293077d1 100644 --- a/src/cmd/fix/main_test.go +++ b/src/cmd/fix/main_test.go @@ -17,7 +17,7 @@ import ( func init() { // If cgo is enabled, enforce that cgo commands invoked by cmd/fix // do not fail during testing. - if testenv.HasCGO() { + if testenv.HasCGO() && testenv.HasGoBuild() { // The reportCgoError hook is global, so we can't set it per-test // if we want to be able to run those tests in parallel. // Instead, simply set it to panic on error: the goroutine dump