Skip to content

Commit 8fa1a69

Browse files
committed
go/types: use testenv.MustHaveGoBuild to exclude some builds
Replace custom solution with new (internal) library call. Change-Id: I53b26a1caf0684b9f5d8d749b10d9f3ba18a3001 Reviewed-on: https://go-review.googlesource.com/11193 Reviewed-by: Damien Neil <[email protected]>
1 parent bc7a3a6 commit 8fa1a69

File tree

6 files changed

+16
-25
lines changed

6 files changed

+16
-25
lines changed

src/go/types/api_test.go

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,13 @@ import (
1111
"go/importer"
1212
"go/parser"
1313
"go/token"
14-
"runtime"
14+
"internal/testenv"
1515
"strings"
1616
"testing"
1717

1818
. "go/types"
1919
)
2020

21-
// skipSpecialPlatforms causes the test to be skipped for platforms where
22-
// builders (build.golang.org) don't have access to compiled packages for
23-
// import.
24-
func skipSpecialPlatforms(t *testing.T) {
25-
switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform {
26-
case "nacl-amd64p32",
27-
"nacl-386",
28-
"nacl-arm",
29-
"darwin-arm",
30-
"darwin-arm64":
31-
t.Skipf("no compiled packages available for import on %s", platform)
32-
}
33-
}
34-
3521
func pkgFor(path, source string, info *Info) (*Package, error) {
3622
fset := token.NewFileSet()
3723
f, err := parser.ParseFile(fset, path, source, 0)
@@ -299,7 +285,7 @@ func predString(tv TypeAndValue) string {
299285
}
300286

301287
func TestPredicatesInfo(t *testing.T) {
302-
skipSpecialPlatforms(t)
288+
testenv.MustHaveGoBuild(t)
303289

304290
var tests = []struct {
305291
src string
@@ -385,7 +371,7 @@ func TestPredicatesInfo(t *testing.T) {
385371
}
386372

387373
func TestScopesInfo(t *testing.T) {
388-
skipSpecialPlatforms(t)
374+
testenv.MustHaveGoBuild(t)
389375

390376
var tests = []struct {
391377
src string

src/go/types/check_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"go/parser"
3333
"go/scanner"
3434
"go/token"
35+
"internal/testenv"
3536
"io/ioutil"
3637
"regexp"
3738
"strings"
@@ -279,7 +280,7 @@ func checkFiles(t *testing.T, testfiles []string) {
279280
}
280281

281282
func TestCheck(t *testing.T) {
282-
skipSpecialPlatforms(t)
283+
testenv.MustHaveGoBuild(t)
283284

284285
// Declare builtins for testing.
285286
DefPredeclaredTestFuncs()

src/go/types/eval_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"go/importer"
1212
"go/parser"
1313
"go/token"
14+
"internal/testenv"
1415
"strings"
1516
"testing"
1617

@@ -86,7 +87,7 @@ func TestEvalArith(t *testing.T) {
8687
}
8788

8889
func TestEvalPos(t *testing.T) {
89-
skipSpecialPlatforms(t)
90+
testenv.MustHaveGoBuild(t)
9091

9192
// The contents of /*-style comments are of the form
9293
// expr => value, type

src/go/types/resolver_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"go/importer"
1111
"go/parser"
1212
"go/token"
13+
"internal/testenv"
1314
"sort"
1415
"testing"
1516

@@ -35,7 +36,7 @@ func (imp *resolveTestImporter) Import(path string) (*Package, error) {
3536
}
3637

3738
func TestResolveIdents(t *testing.T) {
38-
skipSpecialPlatforms(t)
39+
testenv.MustHaveGoBuild(t)
3940

4041
sources := []string{
4142
`

src/go/types/stdlib_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"go/parser"
1616
"go/scanner"
1717
"go/token"
18+
"internal/testenv"
1819
"io/ioutil"
1920
"os"
2021
"path/filepath"
@@ -36,7 +37,7 @@ var (
3637
)
3738

3839
func TestStdlib(t *testing.T) {
39-
skipSpecialPlatforms(t)
40+
testenv.MustHaveGoBuild(t)
4041

4142
start = time.Now()
4243
walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
@@ -124,7 +125,7 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
124125
}
125126

126127
func TestStdTest(t *testing.T) {
127-
skipSpecialPlatforms(t)
128+
testenv.MustHaveGoBuild(t)
128129

129130
// test/recover4.go is only built for Linux and Darwin.
130131
// TODO(gri) Remove once tests consider +build tags (issue 10370).
@@ -139,7 +140,7 @@ func TestStdTest(t *testing.T) {
139140
}
140141

141142
func TestStdFixed(t *testing.T) {
142-
skipSpecialPlatforms(t)
143+
testenv.MustHaveGoBuild(t)
143144

144145
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
145146
"bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
@@ -151,7 +152,7 @@ func TestStdFixed(t *testing.T) {
151152
}
152153

153154
func TestStdKen(t *testing.T) {
154-
skipSpecialPlatforms(t)
155+
testenv.MustHaveGoBuild(t)
155156

156157
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
157158
}

src/go/types/typestring_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"go/importer"
1010
"go/parser"
1111
"go/token"
12+
"internal/testenv"
1213
"testing"
1314

1415
. "go/types"
@@ -117,7 +118,7 @@ var dependentTestTypes = []testEntry{
117118
}
118119

119120
func TestTypeString(t *testing.T) {
120-
skipSpecialPlatforms(t)
121+
testenv.MustHaveGoBuild(t)
121122

122123
var tests []testEntry
123124
tests = append(tests, independentTestTypes...)

0 commit comments

Comments
 (0)