diff options
| author | Bryan C. Mills <bcmills@google.com> | 2022-03-09 17:19:23 -0500 |
|---|---|---|
| committer | Bryan Mills <bcmills@google.com> | 2022-03-18 21:55:52 +0000 |
| commit | 58631ba54f45506f2f178bb01d22273e7dfba674 (patch) | |
| tree | 6833d66fdc88efd536d43d0a71f3e61aec77778e /src/cmd/link | |
| parent | 9ac75d39514402d9b314e758524dcc28612b8937 (diff) | |
| download | go-58631ba54f45506f2f178bb01d22273e7dfba674.tar.xz | |
internal/testenv: add GOROOT and use it to fix tests broken with -trimpath
This fixes many (but not all) of the tests that currently fail
(due to a bogus path reported by runtime.GOROOT) when run with
'go test -trimpath std cmd'.
Updates #51461
Change-Id: Ia2cc05705529c4859e7928f32eeceed647f2e986
Reviewed-on: https://go-review.googlesource.com/c/go/+/391806
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>
Diffstat (limited to 'src/cmd/link')
| -rw-r--r-- | src/cmd/link/internal/ld/nooptcgolink_test.go | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/nooptcgolink_test.go b/src/cmd/link/internal/ld/nooptcgolink_test.go index 73548dabd4..0b76ecaecb 100644 --- a/src/cmd/link/internal/ld/nooptcgolink_test.go +++ b/src/cmd/link/internal/ld/nooptcgolink_test.go @@ -8,7 +8,6 @@ import ( "internal/testenv" "os/exec" "path/filepath" - "runtime" "testing" ) @@ -22,7 +21,7 @@ func TestNooptCgoBuild(t *testing.T) { testenv.MustHaveCGO(t) dir := t.TempDir() cmd := exec.Command(testenv.GoToolPath(t), "build", "-gcflags=-N -l", "-o", filepath.Join(dir, "a.out")) - cmd.Dir = filepath.Join(runtime.GOROOT(), "src", "runtime", "testdata", "testprogcgo") + cmd.Dir = filepath.Join(testenv.GOROOT(t), "src", "runtime", "testdata", "testprogcgo") out, err := cmd.CombinedOutput() if err != nil { t.Logf("go build output: %s", out) |
