]> Cypherpunks repositories - gostls13.git/commit
cmd/go: refactor TestScript/build_issue48319 to check a more general property
authorBryan C. Mills <bcmills@google.com>
Wed, 26 Jan 2022 14:24:25 +0000 (09:24 -0500)
committerBryan Mills <bcmills@google.com>
Wed, 26 Jan 2022 16:15:53 +0000 (16:15 +0000)
commita9eedc0789085f55193bdbf0d777b8eaeccb1890
treef6c30b999ac4645420b1f06c6ca83da186f78fd6
parent5b1b80beb1a2a9a353738e80777d1e25cfdfa095
cmd/go: refactor TestScript/build_issue48319 to check a more general property

The test previously checked that the DWARF DW_AT_comp_dir attribute
matched GOROOT_FINAL. However, on further consideration, we believe
that DW_AT_comp_dir should not actually match GOROOT_FINAL: the DWARF
spec says that DW_AT_comp_dir records “the current working directory
of the compilation command that produced this compilation unit”, but
the actual working directory of the compilation command proper is a
throwaway directory in the build cache — it is neither stable nor
meaningful.

However, the test was getting at a real issue that we do care about:
namely, that the binary produced by a 'go build' command with cgo
enabled should not reuse a dependency that embeds a stale
GOROOT_FINAL.

This change refactors the test to verify the latter property instead
of checking DW_AT_comp_dir specifically.

For #50183
Updates #48319

Change-Id: I0b1151d9ba3d0ff903f72e27850306406e5cb518
Reviewed-on: https://go-review.googlesource.com/c/go/+/380914
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
Reviewed-by: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/testdata/script/build_issue48319.txt