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.
14 func TestCgoCrashHandler(t
*testing
.T
) {
15 testCrashHandler(t
, true)
18 func TestCgoSignalDeadlock(t
*testing
.T
) {
19 if testing
.Short() && runtime
.GOOS
== "windows" {
20 t
.Skip("Skipping in short mode") // takes up to 64 seconds
22 t
.Skip("gccgo does not have a go command")
23 got
:= executeTest(t
, cgoSignalDeadlockSource
, nil)
26 t
.Fatalf("expected %q, but got %q", want
, got
)
30 func TestCgoTraceback(t
*testing
.T
) {
31 got
:= executeTest(t
, cgoTracebackSource
, nil)
34 t
.Fatalf("expected %q, but got %q", want
, got
)
38 const cgoSignalDeadlockSource
= `
50 runtime.GOMAXPROCS(100)
51 ping := make(chan bool)
73 time.Sleep(time.Millisecond)
74 for i := 0; i < 64; i++ {
76 runtime.LockOSThread()
80 runtime.LockOSThread()
83 time.Sleep(time.Millisecond)
87 case <-time.After(time.Second):
95 case <-time.After(time.Second):
103 const cgoTracebackSource
= `
106 /* void foo(void) {} */
116 buf := make([]byte, 1)
117 runtime.Stack(buf, true)