aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/syntax/parser_test.go
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2022-03-09 17:19:23 -0500
committerBryan Mills <bcmills@google.com>2022-03-18 21:55:52 +0000
commit58631ba54f45506f2f178bb01d22273e7dfba674 (patch)
tree6833d66fdc88efd536d43d0a71f3e61aec77778e /src/cmd/compile/internal/syntax/parser_test.go
parent9ac75d39514402d9b314e758524dcc28612b8937 (diff)
downloadgo-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/compile/internal/syntax/parser_test.go')
-rw-r--r--src/cmd/compile/internal/syntax/parser_test.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/syntax/parser_test.go b/src/cmd/compile/internal/syntax/parser_test.go
index ecb21e070b..66690a527a 100644
--- a/src/cmd/compile/internal/syntax/parser_test.go
+++ b/src/cmd/compile/internal/syntax/parser_test.go
@@ -8,6 +8,7 @@ import (
"bytes"
"flag"
"fmt"
+ "internal/testenv"
"io/ioutil"
"path/filepath"
"regexp"
@@ -74,12 +75,14 @@ func TestStdLib(t *testing.T) {
lines uint
}
+ goroot := testenv.GOROOT(t)
+
results := make(chan parseResult)
go func() {
defer close(results)
for _, dir := range []string{
- filepath.Join(runtime.GOROOT(), "src"),
- filepath.Join(runtime.GOROOT(), "misc"),
+ filepath.Join(goroot, "src"),
+ filepath.Join(goroot, "misc"),
} {
walkDirs(t, dir, func(filename string) {
if skipRx != nil && skipRx.MatchString(filename) {