runtime: skip TestCgoExternalThreadSIGPROF on OS X 10.6

The test program requires static constructor, which in turn needs
external linking to work, but external linking never works on 10.6.

This should fix the darwin-{386,amd64} builders.

Change-Id: I714fdd3e35f9a7e5f5659cf26367feec9412444f
Reviewed-on: https://go-review.googlesource.com/2235
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Shenghou Ma 2015-01-01 01:10:39 -05:00 committed by Minux Ma
parent 0e05bd59ac
commit 2cbe27a272

View file

@ -9,6 +9,7 @@ package runtime_test
import ( import (
"runtime" "runtime"
"strings" "strings"
"syscall"
"testing" "testing"
) )
@ -52,8 +53,20 @@ func TestCgoExternalThreadPanic(t *testing.T) {
func TestCgoExternalThreadSIGPROF(t *testing.T) { func TestCgoExternalThreadSIGPROF(t *testing.T) {
// issue 9456. // issue 9456.
if runtime.GOOS == "plan9" || runtime.GOOS == "windows" { switch runtime.GOOS {
case "plan9", "windows":
t.Skipf("no pthreads on %s", runtime.GOOS) t.Skipf("no pthreads on %s", runtime.GOOS)
case "darwin":
// static constructor needs external linking, but we don't support
// external linking on OS X 10.6.
osver, err := syscall.Sysctl("kern.osrelease")
if err != nil {
t.Fatalf("Sysctl(kern.osrelease) failed: %v", err)
}
// OS X 10.6 == Darwin 10.x
if strings.HasPrefix(osver, "10.") {
t.Skipf("no external linking on OS X 10.6")
}
} }
got := executeTest(t, cgoExternalThreadSIGPROFSource, nil) got := executeTest(t, cgoExternalThreadSIGPROFSource, nil)
want := "OK\n" want := "OK\n"