]> Cypherpunks repositories - gostls13.git/commitdiff
go/internal/srcimporter: skip tests on iOS
authorElias Naur <elias.naur@gmail.com>
Wed, 8 Mar 2017 21:54:52 +0000 (22:54 +0100)
committerElias Naur <elias.naur@gmail.com>
Wed, 8 Mar 2017 22:31:00 +0000 (22:31 +0000)
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>
src/go/internal/srcimporter/srcimporter_test.go
src/internal/testenv/testenv.go

index f289bfb44b9d704575a58b2098d71d25326a3ea3..79921b5e7855bd0ba46f1541baa137a6fe493aaa 100644 (file)
@@ -76,7 +76,7 @@ func walkDir(t *testing.T, path string, endTime time.Time) (int, bool) {
 }
 
 func TestImportStdLib(t *testing.T) {
-       if runtime.GOOS == "nacl" {
+       if !testenv.HasSrc() {
                t.Skip("no source code available")
        }
 
@@ -102,7 +102,7 @@ var importedObjectTests = []struct {
 }
 
 func TestImportedTypes(t *testing.T) {
-       if runtime.GOOS == "nacl" {
+       if !testenv.HasSrc() {
                t.Skip("no source code available")
        }
 
@@ -134,7 +134,7 @@ func TestImportedTypes(t *testing.T) {
 }
 
 func TestReimport(t *testing.T) {
-       if runtime.GOOS == "nacl" {
+       if !testenv.HasSrc() {
                t.Skip("no source code available")
        }
 
index 10384b62062a6301361dc537c1109bef34d0c1a0..4cd8a2b541ec4f5653581b4f4bcf20f559b032d6 100644 (file)
@@ -114,6 +114,19 @@ func HasExec() bool {
        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
 // using os.StartProcess or (more commonly) exec.Command.
 // If not, MustHaveExec calls t.Skip with an explanation.