diff options
| author | Bryan C. Mills <bcmills@google.com> | 2020-06-05 16:08:08 -0400 |
|---|---|---|
| committer | Bryan C. Mills <bcmills@google.com> | 2020-06-09 02:49:06 +0000 |
| commit | cacac8bdc5c93e7bc71df71981fdf32dded017bf (patch) | |
| tree | a446c52808abf100906c992122656a45b8e51c69 /src/cmd/objdump | |
| parent | e64675a79fef5924f268425de021372df874010e (diff) | |
| download | go-cacac8bdc5c93e7bc71df71981fdf32dded017bf.tar.xz | |
cmd/dist: do not unset GOROOT_FINAL prior to running tests
Also do not unset it by default in the tests for cmd/go.
GOROOT_FINAL affects the GOROOT value embedded in binaries,
such as 'cmd/cgo'. If its value changes and a build command
is performed that depends on one of those binaries, the binary
would be spuriously rebuilt.
Instead, only unset it in the specific tests that make assumptions
about the GOROOT paths embedded in specific compiled binaries.
That may cause those tests to do a little extra rebuilding when
GOROOT_FINAL is set, but that little bit of extra rebuilding
seems preferable to spuriously-stale binaries.
Fixes #39385
Change-Id: I7c87b1519bb5bcff64babf1505fd1033ffa4f4fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/236819
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/cmd/objdump')
| -rw-r--r-- | src/cmd/objdump/objdump_test.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/objdump/objdump_test.go b/src/cmd/objdump/objdump_test.go index c974d6707b..a9dc7d1a5e 100644 --- a/src/cmd/objdump/objdump_test.go +++ b/src/cmd/objdump/objdump_test.go @@ -138,7 +138,11 @@ func testDisasm(t *testing.T, printCode bool, printGnuAsm bool, flags ...string) args = append(args, flags...) args = append(args, "fmthello.go") cmd := exec.Command(testenv.GoToolPath(t), args...) - cmd.Dir = "testdata" // "Bad line" bug #36683 is sensitive to being run in the source directory + // "Bad line" bug #36683 is sensitive to being run in the source directory. + cmd.Dir = "testdata" + // Ensure that the source file location embedded in the binary matches our + // actual current GOROOT, instead of GOROOT_FINAL if set. + cmd.Env = append(os.Environ(), "GOROOT_FINAL=") t.Logf("Running %v", cmd.Args) out, err := cmd.CombinedOutput() if err != nil { |
