diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-14 13:47:28 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-06-14 13:47:28 +0000 |
commit | 0818233f800920bf4d5c384718b6fb328bba81fe (patch) | |
tree | 9fed014ef5dbc40f5099ade7ed858784fb31b09a | |
parent | 6916d6104ff448f07130597473356334c3d73501 (diff) | |
download | gcc-0818233f800920bf4d5c384718b6fb328bba81fe.zip gcc-0818233f800920bf4d5c384718b6fb328bba81fe.tar.gz gcc-0818233f800920bf4d5c384718b6fb328bba81fe.tar.bz2 |
internal/testenv: support testing gccgo
If GO_TESTING_GOTOOLS is set in the environment, permit tests using
gccgo to run the go tool. Like GO_BUILDER_NAME, this should not be set
normally. But it is needed when testing the go tool itself, and will
be set by the gotools Makefile in a future CL.
Reviewed-on: https://go-review.googlesource.com/45693
From-SVN: r249195
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/internal/testenv/testenv.go | 17 |
2 files changed, 15 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index 4365d6e..21bf5f2 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c0840d5826abb713487b2d8a04ab249764b21010 +6d1d558109b5f5e53b31cc3325485dbb9f06d430 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/internal/testenv/testenv.go b/libgo/go/internal/testenv/testenv.go index 71a692b..8d41638 100644 --- a/libgo/go/internal/testenv/testenv.go +++ b/libgo/go/internal/testenv/testenv.go @@ -22,6 +22,13 @@ import ( "testing" ) +// testingGotools reports whether we are testing the gotools directory +// that is part of GCC. We just use an environment variable set by the +// gotools check target. +func testingGotools() bool { + return os.Getenv("GO_TESTING_GOTOOLS") != "" +} + // Builder reports the name of the builder running this test // (for example, "linux-amd64" or "windows-386-gce"). // If the test is not running on the build infrastructure, @@ -42,14 +49,16 @@ func HasGoBuild() bool { } } // gccgo tests can not run "go build". - return false + return testingGotools() } // MustHaveGoBuild checks that the current system can build programs with ``go build'' // and then run them with os.StartProcess or exec.Command. // If not, MustHaveGoBuild calls t.Skip with an explanation. func MustHaveGoBuild(t *testing.T) { - t.Skip("skipping test: 'go build' not available for gccgo tests") + if !testingGotools() { + t.Skip("skipping test: 'go build' not available for gccgo tests") + } if !HasGoBuild() { t.Skipf("skipping test: 'go build' not available on %s/%s", runtime.GOOS, runtime.GOARCH) } @@ -64,7 +73,9 @@ func HasGoRun() bool { // MustHaveGoRun checks that the current system can run programs with ``go run.'' // If not, MustHaveGoRun calls t.Skip with an explanation. func MustHaveGoRun(t *testing.T) { - t.Skip("skipping test: 'go run' not available for gccgo tests") + if !testingGotools() { + t.Skip("skipping test: 'go run' not available for gccgo tests") + } if !HasGoRun() { t.Skipf("skipping test: 'go run' not available on %s/%s", runtime.GOOS, runtime.GOARCH) } |