Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(83)

Delta Between Two Patch Sets: src/pkg/runtime/crash_cgo_test.go

Issue 12609043: code review 12609043: runtime: fix traceback in cgo programs (Closed)
Left Patch Set: Created 11 years, 7 months ago
Right Patch Set: diff -r 34399c318fa2 https://dvyukov%40google.com@code.google.com/p/go/ Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/runtime/panic.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2012 The Go Authors. All rights reserved. 1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // +build cgo 5 // +build cgo
6 6
7 package runtime_test 7 package runtime_test
8 8
9 import ( 9 import (
10 "runtime" 10 "runtime"
11 "testing" 11 "testing"
12 ) 12 )
13 13
14 func TestCgoCrashHandler(t *testing.T) { 14 func TestCgoCrashHandler(t *testing.T) {
15 testCrashHandler(t, true) 15 testCrashHandler(t, true)
16 } 16 }
17 17
18 func TestCgoSignalDeadlock(t *testing.T) { 18 func TestCgoSignalDeadlock(t *testing.T) {
19 if testing.Short() && runtime.GOOS == "windows" { 19 if testing.Short() && runtime.GOOS == "windows" {
20 t.Skip("Skipping in short mode") // takes up to 64 seconds 20 t.Skip("Skipping in short mode") // takes up to 64 seconds
21 } 21 }
22 got := executeTest(t, cgoSignalDeadlockSource, nil) 22 got := executeTest(t, cgoSignalDeadlockSource, nil)
23 want := "OK\n"
24 if got != want {
25 t.Fatalf("expected %q, but got %q", want, got)
26 }
27 }
28
29 func TestCgoTraceback(t *testing.T) {
30 got := executeTest(t, cgoTracebackSource, nil)
23 want := "OK\n" 31 want := "OK\n"
24 if got != want { 32 if got != want {
25 t.Fatalf("expected %q, but got %q", want, got) 33 t.Fatalf("expected %q, but got %q", want, got)
26 } 34 }
27 } 35 }
28 36
29 const cgoSignalDeadlockSource = ` 37 const cgoSignalDeadlockSource = `
30 package main 38 package main
31 39
32 import "C" 40 import "C"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 ping <- true 91 ping <- true
84 select { 92 select {
85 case <-ping: 93 case <-ping:
86 case <-time.After(time.Second): 94 case <-time.After(time.Second):
87 fmt.Printf("HANG\n") 95 fmt.Printf("HANG\n")
88 return 96 return
89 } 97 }
90 fmt.Printf("OK\n") 98 fmt.Printf("OK\n")
91 } 99 }
92 ` 100 `
101
102 const cgoTracebackSource = `
103 package main
104
105 /* void foo(void) {} */
106 import "C"
107
108 import (
109 "fmt"
110 "runtime"
111 )
112
113 func main() {
114 C.foo()
115 buf := make([]byte, 1)
116 runtime.Stack(buf, true)
117 fmt.Printf("OK\n")
118 }
119 `
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b