diff --git a/misc/cgo/test/cgo_stubs_android_test.go b/misc/cgo/test/cgo_stubs_android_test.go new file mode 100644 index 00000000000000..710e094cf77c1d --- /dev/null +++ b/misc/cgo/test/cgo_stubs_android_test.go @@ -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) {} diff --git a/misc/cgo/test/issue3775.go b/misc/cgo/test/issue3775.go index 8f818541953200..5aca7602c03ff5 100644 --- a/misc/cgo/test/issue3775.go +++ b/misc/cgo/test/issue3775.go @@ -1,3 +1,5 @@ +// +build !android + package cgotest /* diff --git a/misc/cgo/test/issue6997_linux.c b/misc/cgo/test/issue6997_linux.c index 1d5fb2ac7e09a8..de803d296e9ee6 100644 --- a/misc/cgo/test/issue6997_linux.c +++ b/misc/cgo/test/issue6997_linux.c @@ -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 #include #include diff --git a/misc/cgo/test/issue6997_linux.go b/misc/cgo/test/issue6997_linux.go index aaa51dcbf899b2..0c98ea0794eec3 100644 --- a/misc/cgo/test/issue6997_linux.go +++ b/misc/cgo/test/issue6997_linux.go @@ -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 diff --git a/misc/cgo/test/issue7978.go b/misc/cgo/test/issue7978.go index 94ea0b6fa381ea..d5f6cc71d08365 100644 --- a/misc/cgo/test/issue7978.go +++ b/misc/cgo/test/issue7978.go @@ -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") } diff --git a/misc/cgo/test/issue8694.go b/misc/cgo/test/issue8694.go index 00ab7d5202ce13..89be7ea090763a 100644 --- a/misc/cgo/test/issue8694.go +++ b/misc/cgo/test/issue8694.go @@ -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 /* diff --git a/misc/cgo/test/sigaltstack.go b/misc/cgo/test/sigaltstack.go index b641ff60374142..b16adc7d88f982 100644 --- a/misc/cgo/test/sigaltstack.go +++ b/misc/cgo/test/sigaltstack.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 +// +build !windows,!android // Test that the Go runtime still works if C code changes the signal stack. diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 1a1f7d961bea77..33ed018245cf79 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -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