mirror of https://github.com/golang/go.git
go/types: more selective disabling of tests
Disable importer-dependent tests on platforms for which the respective builders don't have access to importable packages. Fixes #10368. Change-Id: I8072c59d2bbbc24a43d771fd04fd0b1a678d765a Reviewed-on: https://go-review.googlesource.com/8611 Reviewed-by: Minux Ma <minux@golang.org>
This commit is contained in:
parent
7ac67b5568
commit
ad266b9605
|
|
@ -18,18 +18,17 @@ import (
|
|||
_ "go/types/internal/gcimporter"
|
||||
)
|
||||
|
||||
// skipTest returns true for platforms on which the current gcimporter doesn't work.
|
||||
// TODO(gri) eliminate this ASAP.
|
||||
func skipTest() bool {
|
||||
switch runtime.GOOS + "-" + runtime.GOARCH {
|
||||
// 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",
|
||||
"windows-amd64",
|
||||
"nacl-386",
|
||||
"windows-386",
|
||||
"plan9-386":
|
||||
return true
|
||||
"darwin-arm",
|
||||
"darwin-arm64":
|
||||
t.Skipf("no compiled packages available for import on %s", platform)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func pkgFor(path, source string, info *Info) (*Package, error) {
|
||||
|
|
@ -299,9 +298,7 @@ func predString(tv TypeAndValue) string {
|
|||
}
|
||||
|
||||
func TestPredicatesInfo(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
var tests = []struct {
|
||||
src string
|
||||
|
|
@ -387,9 +384,7 @@ func TestPredicatesInfo(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestScopesInfo(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
var tests = []struct {
|
||||
src string
|
||||
|
|
|
|||
|
|
@ -278,9 +278,7 @@ func checkFiles(t *testing.T, testfiles []string) {
|
|||
}
|
||||
|
||||
func TestCheck(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// Declare builtins for testing.
|
||||
DefPredeclaredTestFuncs()
|
||||
|
|
|
|||
|
|
@ -83,9 +83,7 @@ func TestEvalArith(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestEvalContext(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
src := `
|
||||
package p
|
||||
|
|
|
|||
|
|
@ -18,18 +18,17 @@ import (
|
|||
"go/types"
|
||||
)
|
||||
|
||||
// skipTest returns true for platforms on which the current gcimporter doesn't work.
|
||||
// TODO(gri) eliminate this ASAP.
|
||||
func skipTest() bool {
|
||||
switch runtime.GOOS + "-" + runtime.GOARCH {
|
||||
// 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",
|
||||
"windows-amd64",
|
||||
"nacl-386",
|
||||
"windows-386",
|
||||
"plan9-386":
|
||||
return true
|
||||
"darwin-arm",
|
||||
"darwin-arm64":
|
||||
t.Skipf("no compiled packages available for import on %s", platform)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var gcPath string // Go compiler path
|
||||
|
|
@ -111,8 +110,9 @@ func testDir(t *testing.T, dir string, endTime time.Time) (nimports int) {
|
|||
}
|
||||
|
||||
func TestImport(t *testing.T) {
|
||||
// This package does not handle gccgo export data.
|
||||
if runtime.Compiler == "gccgo" {
|
||||
// This package only handles gc export data.
|
||||
if runtime.Compiler != "gc" {
|
||||
t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -147,14 +147,14 @@ var importedObjectTests = []struct {
|
|||
}
|
||||
|
||||
func TestImportedTypes(t *testing.T) {
|
||||
if skipTest() {
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// This package only handles gc export data.
|
||||
if runtime.Compiler != "gc" {
|
||||
t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
|
||||
return
|
||||
}
|
||||
|
||||
// This package does not handle gccgo export data.
|
||||
if runtime.Compiler == "gccgo" {
|
||||
return
|
||||
}
|
||||
for _, test := range importedObjectTests {
|
||||
s := strings.Split(test.name, ".")
|
||||
if len(s) != 2 {
|
||||
|
|
@ -183,12 +183,11 @@ func TestImportedTypes(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIssue5815(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// This package does not handle gccgo export data.
|
||||
if runtime.Compiler == "gccgo" {
|
||||
// This package only handles gc export data.
|
||||
if runtime.Compiler != "gc" {
|
||||
t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -217,12 +216,11 @@ func TestIssue5815(t *testing.T) {
|
|||
|
||||
// Smoke test to ensure that imported methods get the correct package.
|
||||
func TestCorrectMethodPackage(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// This package does not handle gccgo export data.
|
||||
if runtime.Compiler == "gccgo" {
|
||||
// This package only handles gc export data.
|
||||
if runtime.Compiler != "gc" {
|
||||
t.Skipf("gc-built packages not available (compiler = %s)", runtime.Compiler)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,9 +89,7 @@ var pkgnames = []string{
|
|||
}
|
||||
|
||||
func TestResolveIdents(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// parse package files
|
||||
fset := token.NewFileSet()
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ var (
|
|||
)
|
||||
|
||||
func TestStdlib(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
walkDirs(t, filepath.Join(runtime.GOROOT(), "src"))
|
||||
if testing.Verbose() {
|
||||
|
|
@ -120,7 +118,11 @@ func testTestDir(t *testing.T, path string, ignore ...string) {
|
|||
}
|
||||
|
||||
func TestStdTest(t *testing.T) {
|
||||
if skipTest() {
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
// test/recover4.go is only built for Linux and Darwin.
|
||||
// TODO(gri) Remove once tests consider +build tags (issue 10370).
|
||||
if runtime.GOOS != "linux" || runtime.GOOS != "darwin" {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -131,9 +133,7 @@ func TestStdTest(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStdFixed(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "fixedbugs"),
|
||||
"bug248.go", "bug302.go", "bug369.go", // complex test instructions - ignore
|
||||
|
|
@ -144,9 +144,7 @@ func TestStdFixed(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStdKen(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
testTestDir(t, filepath.Join(runtime.GOROOT(), "test", "ken"))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,9 +116,7 @@ var dependentTestTypes = []testEntry{
|
|||
}
|
||||
|
||||
func TestTypeString(t *testing.T) {
|
||||
if skipTest() {
|
||||
return
|
||||
}
|
||||
skipSpecialPlatforms(t)
|
||||
|
||||
var tests []testEntry
|
||||
tests = append(tests, independentTestTypes...)
|
||||
|
|
|
|||
Loading…
Reference in New Issue