diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-25 14:16:32 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-25 14:16:32 +0000 |
commit | b16084d244418d5421505f09851b5adf5abc35ec (patch) | |
tree | 872f530a1669ad0f37d72c8b952ee5fe88d9e334 | |
parent | 97b8f8679d0db4b9159e1640ff34460aaccace74 (diff) | |
download | gcc-b16084d244418d5421505f09851b5adf5abc35ec.zip gcc-b16084d244418d5421505f09851b5adf5abc35ec.tar.gz gcc-b16084d244418d5421505f09851b5adf5abc35ec.tar.bz2 |
cmd/go: pass down testing gccgo in TestScript
This permits TestScript to work when gccgo is not installed.
Previous testing was using a previously installed gccgo, not the newly
built one.
This revealed that the testing of whether an internal package is
permitted was incorrect for standard library packages, since the
uninstalled gccgo can see internal packages in the uninstalled libgo.
Fix the internal package tests.
This permitted removing a couple of gccgo-specific changes in the
testsuite.
Reviewed-on: https://go-review.googlesource.com/137255
From-SVN: r264570
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/cmd/go/internal/load/pkg.go | 10 | ||||
-rw-r--r-- | libgo/go/cmd/go/script_test.go | 1 | ||||
-rw-r--r-- | libgo/go/cmd/go/testdata/script/mod_internal.txt | 4 |
4 files changed, 12 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 175db5d..65693ff 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -7b25b4dff4778fc4d6b5d6e10594814146b3e5dd +1dbc5b805a1665079008d1ce341991c3554c1eeb The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/cmd/go/internal/load/pkg.go b/libgo/go/cmd/go/internal/load/pkg.go index 0579fd5..b6c9037 100644 --- a/libgo/go/cmd/go/internal/load/pkg.go +++ b/libgo/go/cmd/go/internal/load/pkg.go @@ -953,8 +953,14 @@ func disallowInternal(srcDir string, importer *Package, importerPath string, p * } // We can't check standard packages with gccgo. - if cfg.BuildContext.Compiler == "gccgo" && p.Standard { - return p + if cfg.BuildContext.Compiler == "gccgo" { + if importer == nil { + if p.Standard { + return p + } + } else if importer.Standard || strings.HasPrefix(importerPath, "cmd/") { + return p + } } // The stack includes p.ImportPath. diff --git a/libgo/go/cmd/go/script_test.go b/libgo/go/cmd/go/script_test.go index 02cb17b..9e958e0 100644 --- a/libgo/go/cmd/go/script_test.go +++ b/libgo/go/cmd/go/script_test.go @@ -78,6 +78,7 @@ var extraEnvKeys = []string{ // For gccgo testing. "GO_TESTING_GOTOOLS", + "GCCGO", "GCCGOTOOLDIR", } diff --git a/libgo/go/cmd/go/testdata/script/mod_internal.txt b/libgo/go/cmd/go/testdata/script/mod_internal.txt index 84e77c6..72706fd 100644 --- a/libgo/go/cmd/go/testdata/script/mod_internal.txt +++ b/libgo/go/cmd/go/testdata/script/mod_internal.txt @@ -16,11 +16,11 @@ stderr 'use of internal package golang.org/x/.* not allowed' # Internal packages in the standard library should not leak into modules. ! go build ./fromstd -[!gccgo] stderr 'use of internal package internal/testenv not allowed' +stderr 'use of internal package internal/testenv not allowed' # Packages found via standard-library vendoring should not leak. ! go build ./fromstdvendor -[!gccgo] stderr 'use of vendored package golang_org/x/net/http/httpguts not allowed' +stderr 'use of vendored package golang_org/x/net/http/httpguts not allowed' env GO111MODULE=off ! go build ./fromstdvendor |