]> Cypherpunks.ru repositories - gostls13.git/commitdiff
misc/cgo/test,cmd/dist: enable (most) Cgo tests on Android
authorElias Naur <elias.naur@gmail.com>
Wed, 1 Jun 2016 18:58:02 +0000 (20:58 +0200)
committerElias Naur <elias.naur@gmail.com>
Wed, 1 Jun 2016 22:06:51 +0000 (22:06 +0000)
Some tests cannot build for Android; use build tags and stubs to
skip them.

For #15919

Change-Id: Ieedcb73d4cabe23c3775cfb1d44c1276982dccd9
Reviewed-on: https://go-review.googlesource.com/23634
Run-TryBot: Elias Naur <elias.naur@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
misc/cgo/test/cgo_stubs_android_test.go [new file with mode: 0644]
misc/cgo/test/issue3775.go
misc/cgo/test/issue6997_linux.c
misc/cgo/test/issue6997_linux.go
misc/cgo/test/issue7978.go
misc/cgo/test/issue8694.go
misc/cgo/test/sigaltstack.go
src/cmd/dist/test.go

diff --git a/misc/cgo/test/cgo_stubs_android_test.go b/misc/cgo/test/cgo_stubs_android_test.go
new file mode 100644 (file)
index 0000000..710e094
--- /dev/null
@@ -0,0 +1,13 @@
+// Copyright 2012 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.
+
+package cgotest
+
+import "testing"
+
+// Stubs for tests that fails to build on Android
+func test6997(t *testing.T)        {}
+func test3775(t *testing.T)        {}
+func test8694(t *testing.T)        {}
+func testSigaltstack(t *testing.T) {}
index 8f8185419532005249a17b678e0f5b56a6d3decf..5aca7602c03ff55e199b8d063e1b44c2f42b3851 100644 (file)
@@ -1,3 +1,5 @@
+// +build !android
+
 package cgotest
 
 /*
index 1d5fb2ac7e09a8bcaf5c3815cc9ca2bfe70c992d..de803d296e9ee61ef5d981d5cec1c86ec8c91390 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !android
+
 #include <pthread.h>
 #include <stdio.h>
 #include <unistd.h>
index aaa51dcbf899b29b14e0f5a74c48607286cc9b9e..0c98ea0794eec302d134e0855769758c7286ec35 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !android
+
 // Test that pthread_cancel works as expected
 // (NPTL uses SIGRTMIN to implement thread cancelation)
 // See https://golang.org/issue/6997
index 94ea0b6fa381ea7bbff3747bce21c8b90bd8a542..d5f6cc71d08365eb627b0fd97d45ebd2dbe46268 100644 (file)
@@ -103,6 +103,9 @@ func test7978(t *testing.T) {
        if C.HAS_SYNC_FETCH_AND_ADD == 0 {
                t.Skip("clang required for __sync_fetch_and_add support on darwin/arm")
        }
+       if runtime.GOOS == "android" {
+               t.Skip("GOTRACEBACK is not passed on to the exec wrapper")
+       }
        if os.Getenv("GOTRACEBACK") != "2" {
                t.Fatalf("GOTRACEBACK must be 2")
        }
index 00ab7d5202ce13b1ed6ab98aeaf4164af77cec24..89be7ea090763a909e810bbcff1ebf4a67da6986 100644 (file)
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// +build !android
+
 package cgotest
 
 /*
index b641ff60374142411ef93889beab410c4f6bffd2..b16adc7d88f9822081c4ee969085e916c85fd47e 100644 (file)
@@ -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
+// +build !windows,!android
 
 // Test that the Go runtime still works if C code changes the signal stack.
 
index 1a1f7d961bea77aa31b6073bacca7f5d90d4a722..33ed018245cf79d7f08e4407da3dcb387424094e 100644 (file)
@@ -432,8 +432,8 @@ func (t *tester) registerTests() {
                },
        })
 
-       if t.cgoEnabled && t.goos != "android" && !t.iOS() {
-               // Disabled on android and iOS. golang.org/issue/8345
+       if t.cgoEnabled && !t.iOS() {
+               // Disabled on iOS. golang.org/issue/15919
                t.tests = append(t.tests, distTest{
                        name:    "cgo_stdio",
                        heading: "../misc/cgo/stdio",
@@ -465,9 +465,9 @@ func (t *tester) registerTests() {
                        })
                }
        }
-       if t.cgoEnabled && t.goos != "android" && !t.iOS() {
-               // TODO(crawshaw): reenable on android and iOS
-               // golang.org/issue/8345
+       if t.cgoEnabled && !t.iOS() {
+               // TODO(crawshaw): reenable on iOS
+               // golang.org/issue/15919
                //
                // These tests are not designed to run off the host.
                t.tests = append(t.tests, distTest{
@@ -729,7 +729,7 @@ func (t *tester) runHostTest(dirBanner, pkg string) error {
 func (t *tester) cgoTest(dt *distTest) error {
        env := mergeEnvLists([]string{"GOTRACEBACK=2"}, os.Environ())
 
-       if t.goos == "android" || t.iOS() {
+       if t.iOS() {
                cmd := t.dirCmd("misc/cgo/test", "go", "test", t.tags())
                cmd.Env = env
                return cmd.Run()
@@ -738,7 +738,7 @@ func (t *tester) cgoTest(dt *distTest) error {
        cmd := t.addCmd(dt, "misc/cgo/test", "go", "test", t.tags(), "-ldflags", "-linkmode=auto", t.runFlag(""))
        cmd.Env = env
 
-       if t.gohostos != "dragonfly" && t.gohostarch != "ppc64le" {
+       if t.gohostos != "dragonfly" && t.gohostarch != "ppc64le" && t.goos != "android" {
                // linkmode=internal fails on dragonfly since errno is a TLS relocation.
                // linkmode=internal fails on ppc64le because cmd/link doesn't
                // handle the TOC correctly (issue 15409).
@@ -792,8 +792,10 @@ func (t *tester) cgoTest(dt *distTest) error {
                        if err := cmd.Run(); err != nil {
                                fmt.Println("No support for static linking found (lacks libc.a?), skip cgo static linking test.")
                        } else {
-                               cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
-                               cmd.Env = env
+                               if t.goos != "android" {
+                                       cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
+                                       cmd.Env = env
+                               }
 
                                cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test")
                                cmd.Env = env
@@ -801,8 +803,10 @@ func (t *tester) cgoTest(dt *distTest) error {
                                cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external`)
                                cmd.Env = env
 
-                               cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
-                               cmd.Env = env
+                               if t.goos != "android" {
+                                       cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external -extldflags "-static -pthread"`)
+                                       cmd.Env = env
+                               }
                        }
 
                        if pair != "freebsd-amd64" { // clang -pie fails to link misc/cgo/test