]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: ensure cgo cflags do not leak into dwarf tests
authorCarlos Amedee <carlos@golang.org>
Thu, 23 Jan 2020 21:05:29 +0000 (16:05 -0500)
committerCarlos Amedee <carlos@golang.org>
Fri, 24 Jan 2020 19:47:23 +0000 (19:47 +0000)
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 #35459

Change-Id: Idc9b354aba44fdab424cb0081a4b3ea7a6d0f8e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/216177
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/link/dwarf_test.go

index 37d570f08b13d9c662df850817ec596dbf7d2a7a..d4bb30399d643f551f06abf3feace0ab924511ad 100644 (file)
@@ -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()