x/tools: disable tests not supported on Android

For golang/go#11811.

Change-Id: Icf16a2d47fcf2fe0d79dd825ccb851a3d63a660f
Reviewed-on: https://go-review.googlesource.com/13268
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
diff --git a/cmd/cover/cover_test.go b/cmd/cover/cover_test.go
index d5219a7..a18778b 100644
--- a/cmd/cover/cover_test.go
+++ b/cmd/cover/cover_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package main_test
 
 import (
diff --git a/cmd/fiximports/main_test.go b/cmd/fiximports/main_test.go
index 7320e22..c8f7bc3 100644
--- a/cmd/fiximports/main_test.go
+++ b/cmd/fiximports/main_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package main
 
 import (
diff --git a/cmd/vet/vet_test.go b/cmd/vet/vet_test.go
index 25ee687..6a09e3d 100644
--- a/cmd/vet/vet_test.go
+++ b/cmd/vet/vet_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package main_test
 
 import (
diff --git a/go/buildutil/allpackages_test.go b/go/buildutil/allpackages_test.go
index 552ad6c..d5bd964 100644
--- a/go/buildutil/allpackages_test.go
+++ b/go/buildutil/allpackages_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Incomplete source tree on Android.
+
+// +build !android
+
 package buildutil_test
 
 import (
diff --git a/go/buildutil/util_test.go b/go/buildutil/util_test.go
index f156829..10dae17 100644
--- a/go/buildutil/util_test.go
+++ b/go/buildutil/util_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Incomplete source tree on Android.
+
+// +build !android
+
 package buildutil_test
 
 import (
diff --git a/go/callgraph/cha/cha_test.go b/go/callgraph/cha/cha_test.go
index e8ddda4..38348c0 100644
--- a/go/callgraph/cha/cha_test.go
+++ b/go/callgraph/cha/cha_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package cha_test
 
 import (
diff --git a/go/callgraph/rta/rta_test.go b/go/callgraph/rta/rta_test.go
index 26eec49..e5aa846 100644
--- a/go/callgraph/rta/rta_test.go
+++ b/go/callgraph/rta/rta_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package rta_test
 
 import (
diff --git a/go/gccgoimporter/importer_test.go b/go/gccgoimporter/importer_test.go
index ee47425..78b4349 100644
--- a/go/gccgoimporter/importer_test.go
+++ b/go/gccgoimporter/importer_test.go
@@ -100,6 +100,9 @@
 }
 
 func TestGoxImporter(t *testing.T) {
+	if runtime.GOOS == "android" {
+		t.Skipf("no testdata directory on %s", runtime.GOOS)
+	}
 	initmap := make(map[*types.Package]InitData)
 	imp := GetImporter([]string{"testdata"}, initmap)
 
diff --git a/go/loader/loader_test.go b/go/loader/loader_test.go
index f7d53a7..602590e 100644
--- a/go/loader/loader_test.go
+++ b/go/loader/loader_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package loader_test
 
 import (
diff --git a/go/loader/stdlib_test.go b/go/loader/stdlib_test.go
index f5c45ab..b62ecfb 100644
--- a/go/loader/stdlib_test.go
+++ b/go/loader/stdlib_test.go
@@ -29,6 +29,10 @@
 )
 
 func TestStdlib(t *testing.T) {
+	if runtime.GOOS == "android" {
+		t.Skipf("incomplete std lib on %s", runtime.GOOS)
+	}
+
 	runtime.GC()
 	t0 := time.Now()
 	var memstats runtime.MemStats
@@ -115,9 +119,10 @@
 
 func TestCgoOption(t *testing.T) {
 	switch runtime.GOOS {
-	// On these systems, the net and os/user packages don't use cgo.
-	case "plan9", "solaris", "windows":
-		return
+	// On these systems, the net and os/user packages don't use cgo
+	// or the std library is incomplete (Android).
+	case "android", "plan9", "solaris", "windows":
+		t.Skipf("no cgo or incomplete std lib on %s", runtime.GOOS)
 	}
 	// In nocgo builds (e.g. linux-amd64-nocgo),
 	// there is no "runtime/cgo" package,
diff --git a/go/pointer/pointer_test.go b/go/pointer/pointer_test.go
index 8dfce96..2744d4f 100644
--- a/go/pointer/pointer_test.go
+++ b/go/pointer/pointer_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package pointer_test
 
 // This test uses 'expectation' comments embedded within testdata/*.go
diff --git a/go/pointer/stdlib_test.go b/go/pointer/stdlib_test.go
index 21afdf2..ef7c652 100644
--- a/go/pointer/stdlib_test.go
+++ b/go/pointer/stdlib_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Incomplete source tree on Android.
+
+// +build !android
+
 package pointer
 
 // This file runs the pointer analysis on all packages and tests beneath
diff --git a/go/ssa/interp/interp_test.go b/go/ssa/interp/interp_test.go
index 89e23bd..f36c23e 100644
--- a/go/ssa/interp/interp_test.go
+++ b/go/ssa/interp/interp_test.go
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// +build !windows,!plan9
+// +build !android,!windows,!plan9
 
 package interp_test
 
diff --git a/go/ssa/source_test.go b/go/ssa/source_test.go
index 95df882..75669c1 100644
--- a/go/ssa/source_test.go
+++ b/go/ssa/source_test.go
@@ -13,6 +13,7 @@
 	"go/token"
 	"os"
 	"regexp"
+	"runtime"
 	"strings"
 	"testing"
 
@@ -25,6 +26,10 @@
 )
 
 func TestObjValueLookup(t *testing.T) {
+	if runtime.GOOS == "android" {
+		t.Skipf("no testdata directory on %s", runtime.GOOS)
+	}
+
 	conf := loader.Config{ParserMode: parser.ParseComments}
 	f, err := conf.ParseFile("testdata/objlookup.go", nil)
 	if err != nil {
@@ -189,6 +194,10 @@
 // Ensure that, in debug mode, we can determine the ssa.Value
 // corresponding to every ast.Expr.
 func TestValueForExpr(t *testing.T) {
+	if runtime.GOOS == "android" {
+		t.Skipf("no testdata dir on %s", runtime.GOOS)
+	}
+
 	conf := loader.Config{ParserMode: parser.ParseComments}
 	f, err := conf.ParseFile("testdata/valueforexpr.go", nil)
 	if err != nil {
diff --git a/go/ssa/ssautil/switch_test.go b/go/ssa/ssautil/switch_test.go
index 2acbd7e..a47dbef 100644
--- a/go/ssa/ssautil/switch_test.go
+++ b/go/ssa/ssautil/switch_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// No testdata on Android.
+
+// +build !android
+
 package ssautil_test
 
 import (
diff --git a/go/ssa/stdlib_test.go b/go/ssa/stdlib_test.go
index f64a93a..d339d07 100644
--- a/go/ssa/stdlib_test.go
+++ b/go/ssa/stdlib_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Incomplete source tree on Android.
+
+// +build !android
+
 package ssa_test
 
 // This file runs the SSA builder in sanity-checking mode on all
diff --git a/go/types/api_test.go b/go/types/api_test.go
index 96e10d4..5a0535f 100644
--- a/go/types/api_test.go
+++ b/go/types/api_test.go
@@ -25,7 +25,8 @@
 // import.
 func skipSpecialPlatforms(t *testing.T) {
 	switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform {
-	case "nacl-amd64p32",
+	case "android-arm",
+		"nacl-amd64p32",
 		"nacl-386",
 		"nacl-arm",
 		"darwin-arm",
diff --git a/go/vcs/vcs_test.go b/go/vcs/vcs_test.go
index 226a3e4..d77f20b 100644
--- a/go/vcs/vcs_test.go
+++ b/go/vcs/vcs_test.go
@@ -9,6 +9,7 @@
 	"os"
 	"path/filepath"
 	"reflect"
+	"runtime"
 	"strings"
 	"testing"
 )
@@ -16,6 +17,10 @@
 // Test that RepoRootForImportPath creates the correct RepoRoot for a given importPath.
 // TODO(cmang): Add tests for SVN and BZR.
 func TestRepoRootForImportPath(t *testing.T) {
+	if runtime.GOOS == "android" {
+		t.Skipf("incomplete source tree on %s", runtime.GOOS)
+	}
+
 	tests := []struct {
 		path string
 		want *RepoRoot
diff --git a/oracle/oracle_test.go b/oracle/oracle_test.go
index f1353c7..0dd1cdc 100644
--- a/oracle/oracle_test.go
+++ b/oracle/oracle_test.go
@@ -198,6 +198,8 @@
 
 func TestOracle(t *testing.T) {
 	switch runtime.GOOS {
+	case "android":
+		t.Skipf("skipping test on %q (no testdata dir)", runtime.GOOS)
 	case "windows":
 		t.Skipf("skipping test on %q (no /usr/bin/diff)", runtime.GOOS)
 	}
diff --git a/refactor/eg/eg_test.go b/refactor/eg/eg_test.go
index 3c10bef..295e842 100644
--- a/refactor/eg/eg_test.go
+++ b/refactor/eg/eg_test.go
@@ -1,3 +1,11 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// No testdata on Android.
+
+// +build !android
+
 package eg_test
 
 import (
diff --git a/refactor/importgraph/graph_test.go b/refactor/importgraph/graph_test.go
index 522e5cb..a486c26 100644
--- a/refactor/importgraph/graph_test.go
+++ b/refactor/importgraph/graph_test.go
@@ -1,3 +1,11 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Incomplete std lib sources on Android.
+
+// +build !android
+
 package importgraph_test
 
 import (
diff --git a/refactor/lexical/lexical_test.go b/refactor/lexical/lexical_test.go
index fd237ce..77287a4 100644
--- a/refactor/lexical/lexical_test.go
+++ b/refactor/lexical/lexical_test.go
@@ -2,6 +2,10 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Incomplete std lib sources on Android.
+
+// +build !android
+
 package lexical
 
 import (