]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: use testenv.MustHaveGoBuild to exclude some builds
authorRobert Griesemer <gri@golang.org>
Wed, 17 Jun 2015 22:35:15 +0000 (15:35 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 17 Jun 2015 23:24:35 +0000 (23:24 +0000)
Replace custom solution with new (internal) library call.

Change-Id: I53b26a1caf0684b9f5d8d749b10d9f3ba18a3001
Reviewed-on: https://go-review.googlesource.com/11193
Reviewed-by: Damien Neil <dneil@google.com>
src/go/types/api_test.go
src/go/types/check_test.go
src/go/types/eval_test.go
src/go/types/resolver_test.go
src/go/types/stdlib_test.go
src/go/types/typestring_test.go

index 3ab909c8dd8ede2c6d6db92aef9e76a2ff33b9aa..bdf47e77f153e9dad1b073ef996187cdaef517d5 100644 (file)
@@ -11,27 +11,13 @@ import (
        "go/importer"
        "go/parser"
        "go/token"
-       "runtime"
+       "internal/testenv"
        "strings"
        "testing"
 
        . "go/types"
 )
 
-// skipSpecialPlatforms causes the test to be skipped for platforms where
-// builders (build.golang.org) don't have access to compiled packages for
-// import.
-func skipSpecialPlatforms(t *testing.T) {
-       switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform {
-       case "nacl-amd64p32",
-               "nacl-386",
-               "nacl-arm",
-               "darwin-arm",
-               "darwin-arm64":
-               t.Skipf("no compiled packages available for import on %s", platform)
-       }
-}
-
 func pkgFor(path, source string, info *Info) (*Package, error) {
        fset := token.NewFileSet()
        f, err := parser.ParseFile(fset, path, source, 0)
@@ -299,7 +285,7 @@ func predString(tv TypeAndValue) string {
 }
 
 func TestPredicatesInfo(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        var tests = []struct {
                src  string
@@ -385,7 +371,7 @@ func TestPredicatesInfo(t *testing.T) {
 }
 
 func TestScopesInfo(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        var tests = []struct {
                src    string
index 25843927d0ed29bb89fa2a85b0b737f8761a99f1..5e34c65b6361926197d2aa52ef774deefc731e9a 100644 (file)
@@ -32,6 +32,7 @@ import (
        "go/parser"
        "go/scanner"
        "go/token"
+       "internal/testenv"
        "io/ioutil"
        "regexp"
        "strings"
@@ -279,7 +280,7 @@ func checkFiles(t *testing.T, testfiles []string) {
 }
 
 func TestCheck(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        // Declare builtins for testing.
        DefPredeclaredTestFuncs()
index 7d932d5f4c32a74bc002c5f402cf23aa343d7754..7e0be43e723e4fec13964bfe58065e630b26d5bb 100644 (file)
@@ -11,6 +11,7 @@ import (
        "go/importer"
        "go/parser"
        "go/token"
+       "internal/testenv"
        "strings"
        "testing"
 
@@ -86,7 +87,7 @@ func TestEvalArith(t *testing.T) {
 }
 
 func TestEvalPos(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        // The contents of /*-style comments are of the form
        //      expr => value, type
index f48d380a1d9b5e88ebfcf75bedc42e538427ab4a..34deae268e3e9945b42512063fdbe0cd494579e8 100644 (file)
@@ -10,6 +10,7 @@ import (
        "go/importer"
        "go/parser"
        "go/token"
+       "internal/testenv"
        "sort"
        "testing"
 
@@ -35,7 +36,7 @@ func (imp *resolveTestImporter) Import(path string) (*Package, error) {
 }
 
 func TestResolveIdents(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        sources := []string{
                `
index 28a66cebe3abc9129b77bb6cdf3db2e5c8db445a..c7fe8dfeae1074d25850071285ad8a9a5cceaa06 100644 (file)
@@ -15,6 +15,7 @@ import (
        "go/parser"
        "go/scanner"
        "go/token"
+       "internal/testenv"
        "io/ioutil"
        "os"
        "path/filepath"
@@ -36,7 +37,7 @@ var (
 )
 
 func TestStdlib(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        start = time.Now()
        walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
@@ -124,7 +125,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
 }
 
 func TestStdTest(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        // test/recover4.go is only built for Linux and Darwin.
        // TODO(gri) Remove once tests consider +build tags (issue 10370).
@@ -139,7 +140,7 @@ func TestStdTest(t *testing.T) {
 }
 
 func TestStdFixed(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
                "bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
@@ -151,7 +152,7 @@ func TestStdFixed(t *testing.T) {
 }
 
 func TestStdKen(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
 }
index ecc4ba83c09b9991953d3bdcaf656a4f7260a279..9945ed8c12857ff183d2ce2e15a9d9a7cb2c67d9 100644 (file)
@@ -9,6 +9,7 @@ import (
        "go/importer"
        "go/parser"
        "go/token"
+       "internal/testenv"
        "testing"
 
        . "go/types"
@@ -117,7 +118,7 @@ var dependentTestTypes = []testEntry{
 }
 
 func TestTypeString(t *testing.T) {
-       skipSpecialPlatforms(t)
+       testenv.MustHaveGoBuild(t)
 
        var tests []testEntry
        tests = append(tests, independentTestTypes...)