xref: /aosp_15_r20/external/toolchain-utils/go/patch/go-1.10.2/go6.patch (revision 760c253c1ed00ce9abd48f8546f08516e57485fe)
1*760c253cSXin Liall: disable some tests that have trouble running remotely.
2*760c253cSXin Li
3*760c253cSXin Li--- src/encoding/gob/encoder_test.go
4*760c253cSXin Li+++ src/encoding/gob/encoder_test.go
5*760c253cSXin Li@@ -1125,20 +1125,17 @@ func TestBadData(t *testing.T) {
6*760c253cSXin Li 		if !strings.Contains(err.Error(), test.error) {
7*760c253cSXin Li 			t.Errorf("#%d: decode: expected %q error, got %s", i, test.error, err.Error())
8*760c253cSXin Li 		}
9*760c253cSXin Li 	}
10*760c253cSXin Li }
11*760c253cSXin Li
12*760c253cSXin Li // TestHugeWriteFails tests that enormous messages trigger an error.
13*760c253cSXin Li func TestHugeWriteFails(t *testing.T) {
14*760c253cSXin Li-	if testing.Short() {
15*760c253cSXin Li-		// Requires allocating a monster, so don't do this from all.bash.
16*760c253cSXin Li-		t.Skip("skipping huge allocation in short mode")
17*760c253cSXin Li-	}
18*760c253cSXin Li+	t.Skip("skipping test due to huge memory requirement")
19*760c253cSXin Li 	huge := make([]byte, tooBig)
20*760c253cSXin Li 	huge[0] = 7 // Make sure it's not all zeros.
21*760c253cSXin Li 	buf := new(bytes.Buffer)
22*760c253cSXin Li 	err := NewEncoder(buf).Encode(huge)
23*760c253cSXin Li 	if err == nil {
24*760c253cSXin Li 		t.Fatalf("expected error for huge slice")
25*760c253cSXin Li 	}
26*760c253cSXin Li 	if !strings.Contains(err.Error(), "message too big") {
27*760c253cSXin Li--- src/runtime/crash_cgo_test.go
28*760c253cSXin Li+++ src/runtime/crash_cgo_test.go
29*760c253cSXin Li@@ -246,20 +246,17 @@ func TestCgoCCodeSIGPROF(t *testing.T) {
30*760c253cSXin Li 	got := runTestProg(t, "testprogcgo", "CgoCCodeSIGPROF")
31*760c253cSXin Li 	want := "OK\n"
32*760c253cSXin Li 	if got != want {
33*760c253cSXin Li 		t.Errorf("expected %q got %v", want, got)
34*760c253cSXin Li 	}
35*760c253cSXin Li }
36*760c253cSXin Li
37*760c253cSXin Li func TestCgoCrashTraceback(t *testing.T) {
38*760c253cSXin Li-	t.Parallel()
39*760c253cSXin Li-	if runtime.GOOS != "linux" || (runtime.GOARCH != "amd64" && runtime.GOARCH != "ppc64le") {
40*760c253cSXin Li-		t.Skipf("not yet supported on %s/%s", runtime.GOOS, runtime.GOARCH)
41*760c253cSXin Li-	}
42*760c253cSXin Li+	t.Skipf("skip running remotely")
43*760c253cSXin Li 	got := runTestProg(t, "testprogcgo", "CrashTraceback")
44*760c253cSXin Li 	for i := 1; i <= 3; i++ {
45*760c253cSXin Li 		if !strings.Contains(got, fmt.Sprintf("cgo symbolizer:%d", i)) {
46*760c253cSXin Li 			t.Errorf("missing cgo symbolizer:%d", i)
47*760c253cSXin Li 		}
48*760c253cSXin Li 	}
49*760c253cSXin Li }
50*760c253cSXin Li
51*760c253cSXin Li@@ -268,20 +265,17 @@ func TestCgoTracebackContext(t *testing.T) {
52*760c253cSXin Li 	got := runTestProg(t, "testprogcgo", "TracebackContext")
53*760c253cSXin Li 	want := "OK\n"
54*760c253cSXin Li 	if got != want {
55*760c253cSXin Li 		t.Errorf("expected %q got %v", want, got)
56*760c253cSXin Li 	}
57*760c253cSXin Li }
58*760c253cSXin Li
59*760c253cSXin Li func testCgoPprof(t *testing.T, buildArg, runArg string) {
60*760c253cSXin Li-	t.Parallel()
61*760c253cSXin Li-	if runtime.GOOS != "linux" || (runtime.GOARCH != "amd64" && runtime.GOARCH != "ppc64le") {
62*760c253cSXin Li-		t.Skipf("not yet supported on %s/%s", runtime.GOOS, runtime.GOARCH)
63*760c253cSXin Li-	}
64*760c253cSXin Li+	t.Skipf("skip pprof test")
65*760c253cSXin Li 	testenv.MustHaveGoRun(t)
66*760c253cSXin Li
67*760c253cSXin Li 	exe, err := buildTestProg(t, "testprogcgo", buildArg)
68*760c253cSXin Li 	if err != nil {
69*760c253cSXin Li 		t.Fatal(err)
70*760c253cSXin Li 	}
71*760c253cSXin Li
72*760c253cSXin Li 	got, err := testenv.CleanCmdEnv(goExecCmd(exe, runArg)).CombinedOutput()
73*760c253cSXin Li--- src/runtime/crash_test.go
74*760c253cSXin Li+++ src/runtime/crash_test.go
75*760c253cSXin Li@@ -476,16 +476,17 @@ func TestPanicDeadlockSyscall(t *testing.T) {
76*760c253cSXin Li func TestPanicLoop(t *testing.T) {
77*760c253cSXin Li 	output := runTestProg(t, "testprog", "PanicLoop")
78*760c253cSXin Li 	if want := "panic while printing panic value"; !strings.Contains(output, want) {
79*760c253cSXin Li 		t.Errorf("output does not contain %q:\n%s", want, output)
80*760c253cSXin Li 	}
81*760c253cSXin Li }
82*760c253cSXin Li
83*760c253cSXin Li func TestMemPprof(t *testing.T) {
84*760c253cSXin Li+	t.Skipf("skip pprof test")
85*760c253cSXin Li 	testenv.MustHaveGoRun(t)
86*760c253cSXin Li
87*760c253cSXin Li 	exe, err := buildTestProg(t, "testprog")
88*760c253cSXin Li 	if err != nil {
89*760c253cSXin Li 		t.Fatal(err)
90*760c253cSXin Li 	}
91*760c253cSXin Li
92*760c253cSXin Li 	got, err := testenv.CleanCmdEnv(goExecCmd(exe, "MemProf")).CombinedOutput()
93*760c253cSXin Li--- src/runtime/crash_unix_test.go
94*760c253cSXin Li+++ src/runtime/crash_unix_test.go
95*760c253cSXin Li@@ -169,19 +169,17 @@ func loop(i int, c chan bool) {
96*760c253cSXin Li
97*760c253cSXin Li func TestPanicSystemstack(t *testing.T) {
98*760c253cSXin Li 	// Test that GOTRACEBACK=crash prints both the system and user
99*760c253cSXin Li 	// stack of other threads.
100*760c253cSXin Li
101*760c253cSXin Li 	// The GOTRACEBACK=crash handler takes 0.1 seconds even if
102*760c253cSXin Li 	// it's not writing a core file and potentially much longer if
103*760c253cSXin Li 	// it is. Skip in short mode.
104*760c253cSXin Li-	if testing.Short() {
105*760c253cSXin Li-		t.Skip("Skipping in short mode (GOTRACEBACK=crash is slow)")
106*760c253cSXin Li-	}
107*760c253cSXin Li+	t.Skip("Skipping (GOTRACEBACK=crash hangs on arm)")
108*760c253cSXin Li
109*760c253cSXin Li 	if runtime.Sigisblocked(int(syscall.SIGQUIT)) {
110*760c253cSXin Li 		t.Skip("skipping; SIGQUIT is blocked, see golang.org/issue/19196")
111*760c253cSXin Li 	}
112*760c253cSXin Li
113*760c253cSXin Li 	t.Parallel()
114*760c253cSXin Li 	cmd := exec.Command(os.Args[0], "testPanicSystemstackInternal")
115*760c253cSXin Li 	cmd = testenv.CleanCmdEnv(cmd)
116*760c253cSXin Li@@ -239,16 +237,17 @@ func init() {
117*760c253cSXin Li }
118*760c253cSXin Li
119*760c253cSXin Li func testPanicSystemstackInternal() {
120*760c253cSXin Li 	runtime.BlockOnSystemStack()
121*760c253cSXin Li 	os.Exit(1) // Should be unreachable.
122*760c253cSXin Li }
123*760c253cSXin Li
124*760c253cSXin Li func TestSignalExitStatus(t *testing.T) {
125*760c253cSXin Li+	t.Skipf("skip running remotely")
126*760c253cSXin Li 	testenv.MustHaveGoBuild(t)
127*760c253cSXin Li 	exe, err := buildTestProg(t, "testprog")
128*760c253cSXin Li 	if err != nil {
129*760c253cSXin Li 		t.Fatal(err)
130*760c253cSXin Li 	}
131*760c253cSXin Li 	err = testenv.CleanCmdEnv(goExecCmd(exe, "SignalExitStatus")).Run()
132*760c253cSXin Li 	if err == nil {
133*760c253cSXin Li 		t.Error("test program succeeded unexpectedly")
134*760c253cSXin Li--- src/runtime/fastlog2_test.go
135*760c253cSXin Li+++ src/runtime/fastlog2_test.go
136*760c253cSXin Li@@ -11,21 +11,17 @@ import (
137*760c253cSXin Li )
138*760c253cSXin Li
139*760c253cSXin Li func TestFastLog2(t *testing.T) {
140*760c253cSXin Li 	// Compute the euclidean distance between math.Log2 and the FastLog2
141*760c253cSXin Li 	// implementation over the range of interest for heap sampling.
142*760c253cSXin Li 	const randomBitCount = 26
143*760c253cSXin Li 	var e float64
144*760c253cSXin Li
145*760c253cSXin Li-	inc := 1
146*760c253cSXin Li-	if testing.Short() {
147*760c253cSXin Li-		// Check 1K total values, down from 64M.
148*760c253cSXin Li-		inc = 1 << 16
149*760c253cSXin Li-	}
150*760c253cSXin Li+	inc := 1 << 16
151*760c253cSXin Li 	for i := 1; i < 1<<randomBitCount; i += inc {
152*760c253cSXin Li 		l, fl := math.Log2(float64(i)), runtime.Fastlog2(float64(i))
153*760c253cSXin Li 		d := l - fl
154*760c253cSXin Li 		e += d * d
155*760c253cSXin Li 	}
156*760c253cSXin Li 	e = math.Sqrt(e)
157*760c253cSXin Li
158*760c253cSXin Li 	if e > 1.0 {
159*760c253cSXin Li--- src/runtime/hash_test.go
160*760c253cSXin Li+++ src/runtime/hash_test.go
161*760c253cSXin Li@@ -156,19 +156,17 @@ func TestSmhasherZeros(t *testing.T) {
162*760c253cSXin Li 	for i := 0; i <= N; i++ {
163*760c253cSXin Li 		h.addB(b[:i])
164*760c253cSXin Li 	}
165*760c253cSXin Li 	h.check(t)
166*760c253cSXin Li }
167*760c253cSXin Li
168*760c253cSXin Li // Strings with up to two nonzero bytes all have distinct hashes.
169*760c253cSXin Li func TestSmhasherTwoNonzero(t *testing.T) {
170*760c253cSXin Li-	if testing.Short() {
171*760c253cSXin Li-		t.Skip("Skipping in short mode")
172*760c253cSXin Li-	}
173*760c253cSXin Li+	t.Skip("skipping test due to huge memory requirement")
174*760c253cSXin Li 	h := newHashSet()
175*760c253cSXin Li 	for n := 2; n <= 16; n++ {
176*760c253cSXin Li 		twoNonZero(h, n)
177*760c253cSXin Li 	}
178*760c253cSXin Li 	h.check(t)
179*760c253cSXin Li }
180*760c253cSXin Li func twoNonZero(h *HashSet, n int) {
181*760c253cSXin Li 	b := make([]byte, n)
182*760c253cSXin Li@@ -259,19 +257,17 @@ func setbits(h *HashSet, b []byte, i int, k int) {
183*760c253cSXin Li 		setbits(h, b, j+1, k-1)
184*760c253cSXin Li 		b[j/8] &= byte(^(1 << uint(j&7)))
185*760c253cSXin Li 	}
186*760c253cSXin Li }
187*760c253cSXin Li
188*760c253cSXin Li // Test all possible combinations of n blocks from the set s.
189*760c253cSXin Li // "permutation" is a bad name here, but it is what Smhasher uses.
190*760c253cSXin Li func TestSmhasherPermutation(t *testing.T) {
191*760c253cSXin Li-	if testing.Short() {
192*760c253cSXin Li-		t.Skip("Skipping in short mode")
193*760c253cSXin Li-	}
194*760c253cSXin Li+	t.Skip("skipping test due to huge memory requirement")
195*760c253cSXin Li 	permutation(t, []uint32{0, 1, 2, 3, 4, 5, 6, 7}, 8)
196*760c253cSXin Li 	permutation(t, []uint32{0, 1 << 29, 2 << 29, 3 << 29, 4 << 29, 5 << 29, 6 << 29, 7 << 29}, 8)
197*760c253cSXin Li 	permutation(t, []uint32{0, 1}, 20)
198*760c253cSXin Li 	permutation(t, []uint32{0, 1 << 31}, 20)
199*760c253cSXin Li 	permutation(t, []uint32{0, 1, 2, 3, 4, 5, 6, 7, 1 << 29, 2 << 29, 3 << 29, 4 << 29, 5 << 29, 6 << 29, 7 << 29}, 6)
200*760c253cSXin Li }
201*760c253cSXin Li func permutation(t *testing.T, s []uint32, n int) {
202*760c253cSXin Li 	b := make([]byte, n*4)
203*760c253cSXin Li--- src/runtime/pprof/pprof_test.go
204*760c253cSXin Li+++ src/runtime/pprof/pprof_test.go
205*760c253cSXin Li@@ -278,24 +278,17 @@ func profileOk(t *testing.T, need []string, prof bytes.Buffer, duration time.Dur
206*760c253cSXin Li 	return ok
207*760c253cSXin Li }
208*760c253cSXin Li
209*760c253cSXin Li // Fork can hang if preempted with signals frequently enough (see issue 5517).
210*760c253cSXin Li // Ensure that we do not do this.
211*760c253cSXin Li func TestCPUProfileWithFork(t *testing.T) {
212*760c253cSXin Li 	testenv.MustHaveExec(t)
213*760c253cSXin Li
214*760c253cSXin Li-	heap := 1 << 30
215*760c253cSXin Li-	if runtime.GOOS == "android" {
216*760c253cSXin Li-		// Use smaller size for Android to avoid crash.
217*760c253cSXin Li-		heap = 100 << 20
218*760c253cSXin Li-	}
219*760c253cSXin Li-	if testing.Short() {
220*760c253cSXin Li-		heap = 100 << 20
221*760c253cSXin Li-	}
222*760c253cSXin Li+	heap := 100 << 20
223*760c253cSXin Li 	// This makes fork slower.
224*760c253cSXin Li 	garbage := make([]byte, heap)
225*760c253cSXin Li 	// Need to touch the slice, otherwise it won't be paged in.
226*760c253cSXin Li 	done := make(chan bool)
227*760c253cSXin Li 	go func() {
228*760c253cSXin Li 		for i := range garbage {
229*760c253cSXin Li 			garbage[i] = 42
230*760c253cSXin Li 		}
231