1
0
mirror of https://github.com/golang/go synced 2024-11-05 11:56:12 -07:00

go/internal/srcimporter: skip tests on iOS

The iOS test harness only includes the current test directory in its
app bundles, but the tests need access to all source code.

Change-Id: I8a902b183bc2745b4fbfffef867002d573abb1f5
Reviewed-on: https://go-review.googlesource.com/37961
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Elias Naur 2017-03-08 22:54:52 +01:00
parent 23be728950
commit 3a1271dad7
2 changed files with 16 additions and 3 deletions

View File

@ -76,7 +76,7 @@ func walkDir(t *testing.T, path string, endTime time.Time) (int, bool) {
} }
func TestImportStdLib(t *testing.T) { func TestImportStdLib(t *testing.T) {
if runtime.GOOS == "nacl" { if !testenv.HasSrc() {
t.Skip("no source code available") t.Skip("no source code available")
} }
@ -102,7 +102,7 @@ var importedObjectTests = []struct {
} }
func TestImportedTypes(t *testing.T) { func TestImportedTypes(t *testing.T) {
if runtime.GOOS == "nacl" { if !testenv.HasSrc() {
t.Skip("no source code available") t.Skip("no source code available")
} }
@ -134,7 +134,7 @@ func TestImportedTypes(t *testing.T) {
} }
func TestReimport(t *testing.T) { func TestReimport(t *testing.T) {
if runtime.GOOS == "nacl" { if !testenv.HasSrc() {
t.Skip("no source code available") t.Skip("no source code available")
} }

View File

@ -114,6 +114,19 @@ func HasExec() bool {
return true return true
} }
// HasSrc reports whether the entire source tree is available under GOROOT.
func HasSrc() bool {
switch runtime.GOOS {
case "nacl":
return false
case "darwin":
if strings.HasPrefix(runtime.GOARCH, "arm") {
return false
}
}
return true
}
// MustHaveExec checks that the current system can start new processes // MustHaveExec checks that the current system can start new processes
// using os.StartProcess or (more commonly) exec.Command. // using os.StartProcess or (more commonly) exec.Command.
// If not, MustHaveExec calls t.Skip with an explanation. // If not, MustHaveExec calls t.Skip with an explanation.