1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
16 func TestCgoCrashHandler(t
*testing
.T
) {
17 testCrashHandler(t
, true)
20 func TestCgoSignalDeadlock(t
*testing
.T
) {
21 if testing
.Short() && runtime
.GOOS
== "windows" {
22 t
.Skip("Skipping in short mode") // takes up to 64 seconds
24 got
:= runTestProg(t
, "testprogcgo", "CgoSignalDeadlock")
27 t
.Fatalf("expected %q, but got:\n%s", want
, got
)
31 func TestCgoTraceback(t
*testing
.T
) {
32 got
:= runTestProg(t
, "testprogcgo", "CgoTraceback")
35 t
.Fatalf("expected %q, but got:\n%s", want
, got
)
39 func TestCgoCallbackGC(t
*testing
.T
) {
40 if runtime
.GOOS
== "plan9" || runtime
.GOOS
== "windows" {
41 t
.Skipf("no pthreads on %s", runtime
.GOOS
)
45 case runtime
.GOOS
== "dragonfly":
46 t
.Skip("see golang.org/issue/11990")
47 case runtime
.GOOS
== "linux" && runtime
.GOARCH
== "arm":
48 t
.Skip("too slow for arm builders")
51 got
:= runTestProg(t
, "testprogcgo", "CgoCallbackGC")
54 t
.Fatalf("expected %q, but got:\n%s", want
, got
)
58 func TestCgoExternalThreadPanic(t
*testing
.T
) {
59 if runtime
.GOOS
== "plan9" {
60 t
.Skipf("no pthreads on %s", runtime
.GOOS
)
62 got
:= runTestProg(t
, "testprogcgo", "CgoExternalThreadPanic")
64 if !strings
.Contains(got
, want
) {
65 t
.Fatalf("want failure containing %q. output:\n%s\n", want
, got
)
69 func TestCgoExternalThreadSIGPROF(t
*testing
.T
) {
72 case "plan9", "windows":
73 t
.Skipf("no pthreads on %s", runtime
.GOOS
)
75 if runtime
.GOARCH
!= "arm" && runtime
.GOARCH
!= "arm64" {
76 // static constructor needs external linking, but we don't support
77 // external linking on OS X 10.6.
78 out
, err
:= exec
.Command("uname", "-r").Output()
80 t
.Fatalf("uname -r failed: %v", err
)
82 // OS X 10.6 == Darwin 10.x
83 if strings
.HasPrefix(string(out
), "10.") {
84 t
.Skipf("no external linking on OS X 10.6")
88 if runtime
.GOARCH
== "ppc64" {
89 // TODO(austin) External linking not implemented on
90 // ppc64 (issue #8912)
91 t
.Skipf("no external linking on ppc64")
93 got
:= runTestProg(t
, "testprogcgo", "CgoExternalThreadSIGPROF")
96 t
.Fatalf("expected %q, but got:\n%s", want
, got
)
100 func TestCgoExternalThreadSignal(t
*testing
.T
) {
102 switch runtime
.GOOS
{
103 case "plan9", "windows":
104 t
.Skipf("no pthreads on %s", runtime
.GOOS
)
106 got
:= runTestProg(t
, "testprogcgo", "CgoExternalThreadSignal")
109 t
.Fatalf("expected %q, but got:\n%s", want
, got
)
113 func TestCgoDLLImports(t
*testing
.T
) {
115 if runtime
.GOOS
!= "windows" {
116 t
.Skip("skipping windows specific test")
118 got
:= runTestProg(t
, "testprogcgo", "CgoDLLImportsMain")
121 t
.Fatalf("expected %q, but got %v", want
, got
)
125 func TestCgoExecSignalMask(t
*testing
.T
) {
127 switch runtime
.GOOS
{
128 case "windows", "plan9":
129 t
.Skipf("skipping signal mask test on %s", runtime
.GOOS
)
131 got
:= runTestProg(t
, "testprogcgo", "CgoExecSignalMask")
134 t
.Errorf("expected %q, got %v", want
, got
)
138 func TestEnsureDropM(t
*testing
.T
) {
139 // Test for issue 13881.
140 switch runtime
.GOOS
{
141 case "windows", "plan9":
142 t
.Skipf("skipping dropm test on %s", runtime
.GOOS
)
144 got
:= runTestProg(t
, "testprogcgo", "EnsureDropM")
147 t
.Errorf("expected %q, got %v", want
, got
)