xref: /aosp_15_r20/external/toolchain-utils/go/patch/go-1.10.2/go5.patch (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1*760c253cSXin Liruntime: deadlock detection does not work when using external linker.
2*760c253cSXin Li
3*760c253cSXin Li--- src/runtime/crash_test.go
4*760c253cSXin Li+++ src/runtime/crash_test.go
5*760c253cSXin Li@@ -214,32 +214,37 @@ func testDeadlock(t *testing.T, name string) {
6*760c253cSXin Li 	output := runTestProg(t, "testprog", name)
7*760c253cSXin Li 	want := "fatal error: all goroutines are asleep - deadlock!\n"
8*760c253cSXin Li 	if !strings.HasPrefix(output, want) {
9*760c253cSXin Li 		t.Fatalf("output does not start with %q:\n%s", want, output)
10*760c253cSXin Li 	}
11*760c253cSXin Li }
12*760c253cSXin Li
13*760c253cSXin Li func TestSimpleDeadlock(t *testing.T) {
14*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
15*760c253cSXin Li 	testDeadlock(t, "SimpleDeadlock")
16*760c253cSXin Li }
17*760c253cSXin Li
18*760c253cSXin Li func TestInitDeadlock(t *testing.T) {
19*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
20*760c253cSXin Li 	testDeadlock(t, "InitDeadlock")
21*760c253cSXin Li }
22*760c253cSXin Li
23*760c253cSXin Li func TestLockedDeadlock(t *testing.T) {
24*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
25*760c253cSXin Li 	testDeadlock(t, "LockedDeadlock")
26*760c253cSXin Li }
27*760c253cSXin Li
28*760c253cSXin Li func TestLockedDeadlock2(t *testing.T) {
29*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
30*760c253cSXin Li 	testDeadlock(t, "LockedDeadlock2")
31*760c253cSXin Li }
32*760c253cSXin Li
33*760c253cSXin Li func TestGoexitDeadlock(t *testing.T) {
34*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
35*760c253cSXin Li 	output := runTestProg(t, "testprog", "GoexitDeadlock")
36*760c253cSXin Li 	want := "no goroutines (main called runtime.Goexit) - deadlock!"
37*760c253cSXin Li 	if !strings.Contains(output, want) {
38*760c253cSXin Li 		t.Fatalf("output:\n%s\n\nwant output containing: %s", output, want)
39*760c253cSXin Li 	}
40*760c253cSXin Li }
41*760c253cSXin Li
42*760c253cSXin Li func TestStackOverflow(t *testing.T) {
43*760c253cSXin Li@@ -266,16 +271,17 @@ panic: again
44*760c253cSXin Li `
45*760c253cSXin Li 	if !strings.HasPrefix(output, want) {
46*760c253cSXin Li 		t.Fatalf("output does not start with %q:\n%s", want, output)
47*760c253cSXin Li 	}
48*760c253cSXin Li
49*760c253cSXin Li }
50*760c253cSXin Li
51*760c253cSXin Li func TestGoexitCrash(t *testing.T) {
52*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
53*760c253cSXin Li 	output := runTestProg(t, "testprog", "GoexitExit")
54*760c253cSXin Li 	want := "no goroutines (main called runtime.Goexit) - deadlock!"
55*760c253cSXin Li 	if !strings.Contains(output, want) {
56*760c253cSXin Li 		t.Fatalf("output:\n%s\n\nwant output containing: %s", output, want)
57*760c253cSXin Li 	}
58*760c253cSXin Li }
59*760c253cSXin Li
60*760c253cSXin Li func TestGoexitDefer(t *testing.T) {
61*760c253cSXin Li@@ -324,16 +330,17 @@ func TestBreakpoint(t *testing.T) {
62*760c253cSXin Li 	// "runtime.Breakpoint(...)" instead of "runtime.Breakpoint()".
63*760c253cSXin Li 	want := "runtime.Breakpoint("
64*760c253cSXin Li 	if !strings.Contains(output, want) {
65*760c253cSXin Li 		t.Fatalf("output:\n%s\n\nwant output containing: %s", output, want)
66*760c253cSXin Li 	}
67*760c253cSXin Li }
68*760c253cSXin Li
69*760c253cSXin Li func TestGoexitInPanic(t *testing.T) {
70*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
71*760c253cSXin Li 	// see issue 8774: this code used to trigger an infinite recursion
72*760c253cSXin Li 	output := runTestProg(t, "testprog", "GoexitInPanic")
73*760c253cSXin Li 	want := "fatal error: no goroutines (main called runtime.Goexit) - deadlock!"
74*760c253cSXin Li 	if !strings.HasPrefix(output, want) {
75*760c253cSXin Li 		t.Fatalf("output does not start with %q:\n%s", want, output)
76*760c253cSXin Li 	}
77*760c253cSXin Li }
78*760c253cSXin Li
79*760c253cSXin Li@@ -388,16 +395,17 @@ func TestPanicAfterGoexit(t *testing.T) {
80*760c253cSXin Li 	output := runTestProg(t, "testprog", "PanicAfterGoexit")
81*760c253cSXin Li 	want := "panic: hello"
82*760c253cSXin Li 	if !strings.HasPrefix(output, want) {
83*760c253cSXin Li 		t.Fatalf("output does not start with %q:\n%s", want, output)
84*760c253cSXin Li 	}
85*760c253cSXin Li }
86*760c253cSXin Li
87*760c253cSXin Li func TestRecoveredPanicAfterGoexit(t *testing.T) {
88*760c253cSXin Li+	t.Skip("deadlock detection fails with external linker")
89*760c253cSXin Li 	output := runTestProg(t, "testprog", "RecoveredPanicAfterGoexit")
90*760c253cSXin Li 	want := "fatal error: no goroutines (main called runtime.Goexit) - deadlock!"
91*760c253cSXin Li 	if !strings.HasPrefix(output, want) {
92*760c253cSXin Li 		t.Fatalf("output does not start with %q:\n%s", want, output)
93*760c253cSXin Li 	}
94*760c253cSXin Li }
95*760c253cSXin Li
96*760c253cSXin Li func TestRecoverBeforePanicAfterGoexit(t *testing.T) {
97*760c253cSXin Li--- src/runtime/proc_test.go
98*760c253cSXin Li+++ src/runtime/proc_test.go
99*760c253cSXin Li@@ -349,19 +349,20 @@ func TestGCFairness2(t *testing.T) {
100*760c253cSXin Li 	want := "OK\n"
101*760c253cSXin Li 	if output != want {
102*760c253cSXin Li 		t.Fatalf("want %s, got %s\n", want, output)
103*760c253cSXin Li 	}
104*760c253cSXin Li }
105*760c253cSXin Li
106*760c253cSXin Li func TestNumGoroutine(t *testing.T) {
107*760c253cSXin Li 	output := runTestProg(t, "testprog", "NumGoroutine")
108*760c253cSXin Li-	want := "1\n"
109*760c253cSXin Li-	if output != want {
110*760c253cSXin Li-		t.Fatalf("want %q, got %q", want, output)
111*760c253cSXin Li+	want1 := "1\n"
112*760c253cSXin Li+	want2 := "2\n"
113*760c253cSXin Li+	if output != want1 && output != want2 {
114*760c253cSXin Li+		t.Fatalf("want %q, got %q", want1, output)
115*760c253cSXin Li 	}
116*760c253cSXin Li
117*760c253cSXin Li 	buf := make([]byte, 1<<20)
118*760c253cSXin Li
119*760c253cSXin Li 	// Try up to 10 times for a match before giving up.
120*760c253cSXin Li 	// This is a fundamentally racy check but it's important
121*760c253cSXin Li 	// to notice if NumGoroutine and Stack are _always_ out of sync.
122*760c253cSXin Li 	for i := 0; ; i++ {
123*760c253cSXin Li--- test/fixedbugs/bug429_run.go
124*760c253cSXin Li+++ test/fixedbugs/bug429_run.go
125*760c253cSXin Li@@ -1,10 +1,10 @@
126*760c253cSXin Li // +build !nacl
127*760c253cSXin Li-// runtarget
128*760c253cSXin Li+// skip
129*760c253cSXin Li
130*760c253cSXin Li // Copyright 2014 The Go Authors. All rights reserved.
131*760c253cSXin Li // Use of this source code is governed by a BSD-style
132*760c253cSXin Li // license that can be found in the LICENSE file.
133*760c253cSXin Li
134*760c253cSXin Li // Run the bug429.go test.
135*760c253cSXin Li
136*760c253cSXin Li package main
137*760c253cSXin Li--- test/goprint.go
138*760c253cSXin Li+++ test/goprint.go
139*760c253cSXin Li@@ -3,19 +3,14 @@
140*760c253cSXin Li // Copyright 2011 The Go Authors. All rights reserved.
141*760c253cSXin Li // Use of this source code is governed by a BSD-style
142*760c253cSXin Li // license that can be found in the LICENSE file.
143*760c253cSXin Li
144*760c253cSXin Li // Test that println can be the target of a go statement.
145*760c253cSXin Li
146*760c253cSXin Li package main
147*760c253cSXin Li
148*760c253cSXin Li-import (
149*760c253cSXin Li-	"runtime"
150*760c253cSXin Li-	"time"
151*760c253cSXin Li-)
152*760c253cSXin Li+import "time"
153*760c253cSXin Li
154*760c253cSXin Li func main() {
155*760c253cSXin Li 	go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
156*760c253cSXin Li-	for runtime.NumGoroutine() > 1 {
157*760c253cSXin Li-		time.Sleep(10*time.Millisecond)
158*760c253cSXin Li-	}
159*760c253cSXin Li+	time.Sleep(100*time.Millisecond)
160*760c253cSXin Li }
161