From 0e115a326648cd650f833a175c0505774413d9db Mon Sep 17 00:00:00 2001 From: Carlos Amedee Date: Thu, 23 Jan 2020 16:05:29 -0500 Subject: [release-branch.go1.13] cmd/link: ensure cgo cflags do not leak into dwarf tests Running the dwarf tests with CGO_CFLAGS set with certain values would cause the test to fail. all.bash would fail when CGO_CFLAGS was set to '-mmacosx-version-min=10.10' because the --macosx-version-min flag is incompatible with some dwarf tests. The change guards against using an unintended flag in the unit test. Updates #36846 Updates #35459 Change-Id: Idc9b354aba44fdab424cb0081a4b3ea7a6d0f8e3 Reviewed-on: https://go-review.googlesource.com/c/go/+/216177 Run-TryBot: Carlos Amedee TryBot-Result: Gobot Gobot Reviewed-by: Jay Conrod Reviewed-by: Ian Lance Taylor (cherry picked from commit e948d2b73ede67f12bff9e4d050f0e1425163010) Reviewed-on: https://go-review.googlesource.com/c/go/+/217057 --- src/cmd/link/dwarf_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cmd/link/dwarf_test.go b/src/cmd/link/dwarf_test.go index 897b2fc881..51b2d80960 100644 --- a/src/cmd/link/dwarf_test.go +++ b/src/cmd/link/dwarf_test.go @@ -71,6 +71,7 @@ func testDWARF(t *testing.T, buildmode string, expectDWARF bool, env ...string) } cmd.Args = append(cmd.Args, dir) if env != nil { + env = append(env, "CGO_CFLAGS=") // ensure CGO_CFLAGS does not contain any flags. Issue #35459 cmd.Env = append(os.Environ(), env...) } out, err := cmd.CombinedOutput() -- cgit v1.2.3-54-g00ecf