Skip to content

Commit d12fe60

Browse files
Bryan C. Millsgopherbot
Bryan C. Mills
authored andcommitted
all: skip tests that fail on android/arm64
Many of the tests skipped platforms that build PIE binaries by default, but (still) lack a central function to report which platforms those are. Some of the tests assumed (but did not check for) internal linking support, or invoked `go tool link` directly without properly configuring the external linker. A few of the tests seem to be triggering latent bugs in the linker. For #58806. For #58807. For #58794. Change-Id: Ie4d06b1597f404590ad2abf978d4c363647407ac Reviewed-on: https://go-review.googlesource.com/c/go/+/472455 Reviewed-by: Cherry Mui <[email protected]> Auto-Submit: Bryan Mills <[email protected]> Run-TryBot: Bryan Mills <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 2cbab4e commit d12fe60

File tree

8 files changed

+59
-8
lines changed

8 files changed

+59
-8
lines changed

src/cmd/link/elf_test.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ func TestPIESize(t *testing.T) {
340340
t.Logf("%s", out)
341341
}
342342
if err != nil {
343-
t.Error(err)
343+
t.Log(err)
344344
}
345345
return err
346346
}
@@ -358,6 +358,9 @@ func TestPIESize(t *testing.T) {
358358
}()
359359
wg.Wait()
360360
if errexe != nil || errpie != nil {
361+
if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
362+
testenv.SkipFlaky(t, 58806)
363+
}
361364
t.Fatal("link failed")
362365
}
363366

src/cmd/link/internal/ld/dwarf_test.go

+13-5
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ func main() {
227227
}
228228
switch entry.Tag {
229229
case dwarf.TagStructType:
230-
name := entry.Val(dwarf.AttrName).(string)
230+
name, ok := entry.Val(dwarf.AttrName).(string)
231+
if !ok {
232+
continue
233+
}
231234
wantMembers := want[name]
232235
if wantMembers == nil {
233236
continue
@@ -888,8 +891,10 @@ func TestRuntimeTypeAttrInternal(t *testing.T) {
888891
t.Skip("skipping on plan9; no DWARF symbol table in executables")
889892
}
890893

891-
if runtime.GOOS == "windows" {
892-
t.Skip("skipping on windows; test is incompatible with relocatable binaries")
894+
// TODO(#58807): factor this condition out into a function in
895+
// internal/platform so that it won't get out of sync with cmd/link.
896+
if runtime.GOOS == "android" || runtime.GOOS == "windows" {
897+
t.Skipf("skipping on %s; test is incompatible with relocatable binaries", runtime.GOOS)
893898
}
894899

895900
testRuntimeTypeAttr(t, "-ldflags=-linkmode=internal")
@@ -980,8 +985,10 @@ func main() {
980985
t.Fatalf("*main.X DIE had no runtime type attr. DIE: %v", dies[0])
981986
}
982987

983-
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
984-
return // everything is PIE on ARM64, addresses are relocated
988+
// TODO(#58807): factor this condition out into a function in
989+
// internal/platform so that it won't get out of sync with cmd/link.
990+
if (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") || runtime.GOOS == "android" {
991+
return // everything is PIE, addresses are relocated
985992
}
986993
if rtAttr.(uint64)+types.Addr != addr {
987994
t.Errorf("DWARF type offset was %#x+%#x, but test program said %#x", rtAttr.(uint64), types.Addr, addr)
@@ -1548,6 +1555,7 @@ func TestIssue39757(t *testing.T) {
15481555

15491556
func TestIssue42484(t *testing.T) {
15501557
testenv.MustHaveGoBuild(t)
1558+
testenv.MustInternalLink(t, false) // Avoid spurious failures from external linkers.
15511559

15521560
if runtime.GOOS == "plan9" {
15531561
t.Skip("skipping on plan9; no DWARF symbol table in executables")

src/cmd/link/internal/ld/ld_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ func TestUndefinedRelocErrors(t *testing.T) {
6565
case n > 0:
6666
t.Errorf("unmatched error: %s (x%d)", want, n)
6767
case n < 0:
68+
if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
69+
testenv.SkipFlaky(t, 58807)
70+
}
6871
t.Errorf("extra errors: %s (x%d)", want, -n)
6972
}
7073
}

src/cmd/link/link_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ func TestIssue21703(t *testing.T) {
4141
t.Parallel()
4242

4343
testenv.MustHaveGoBuild(t)
44+
testenv.MustInternalLink(t, false)
4445

4546
const source = `
4647
package main
@@ -70,6 +71,9 @@ func main() {}
7071
cmd.Dir = tmpdir
7172
out, err = cmd.CombinedOutput()
7273
if err != nil {
74+
if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
75+
testenv.SkipFlaky(t, 58806)
76+
}
7377
t.Fatalf("failed to link main.o: %v, output: %s\n", err, out)
7478
}
7579
}
@@ -82,6 +86,7 @@ func TestIssue28429(t *testing.T) {
8286
t.Parallel()
8387

8488
testenv.MustHaveGoBuild(t)
89+
testenv.MustInternalLink(t, false)
8590

8691
tmpdir := t.TempDir()
8792

@@ -97,6 +102,9 @@ func TestIssue28429(t *testing.T) {
97102
cmd.Dir = tmpdir
98103
out, err := cmd.CombinedOutput()
99104
if err != nil {
105+
if len(args) >= 2 && args[1] == "link" && runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
106+
testenv.SkipFlaky(t, 58806)
107+
}
100108
t.Fatalf("'go %s' failed: %v, output: %s",
101109
strings.Join(args, " "), err, out)
102110
}
@@ -763,6 +771,7 @@ func TestIndexMismatch(t *testing.T) {
763771
// This shouldn't happen with "go build". We invoke the compiler and the linker
764772
// manually, and try to "trick" the linker with an inconsistent object file.
765773
testenv.MustHaveGoBuild(t)
774+
testenv.MustInternalLink(t, false)
766775

767776
t.Parallel()
768777

@@ -797,6 +806,9 @@ func TestIndexMismatch(t *testing.T) {
797806
t.Log(cmd)
798807
out, err = cmd.CombinedOutput()
799808
if err != nil {
809+
if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
810+
testenv.SkipFlaky(t, 58806)
811+
}
800812
t.Errorf("linking failed: %v\n%s", err, out)
801813
}
802814

src/cmd/nm/nm_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
165165
return true
166166
}
167167
}
168+
// Code is always relocated if the default buildmode is PIE.
169+
//
170+
// TODO(#58807): factor this condition out into a function in
171+
// internal/platform so that it won't get out of sync with cmd/go and
172+
// cmd/link.
173+
if runtime.GOOS == "android" {
174+
return true
175+
}
168176
if runtime.GOOS == "windows" {
169177
return true
170178
}
@@ -198,7 +206,12 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
198206
stype = "D"
199207
}
200208
if want, have := stype, strings.ToUpper(f[1]); have != want {
201-
t.Errorf("want %s type for %s symbol, but have %s", want, name, have)
209+
if runtime.GOOS == "android" && name == "runtime.epclntab" && have == "D" {
210+
// TODO(#58807): Figure out why this fails and fix up the test.
211+
t.Logf("(ignoring on %s) want %s type for %s symbol, but have %s", runtime.GOOS, want, name, have)
212+
} else {
213+
t.Errorf("want %s type for %s symbol, but have %s", want, name, have)
214+
}
202215
}
203216
delete(runtimeSyms, name)
204217
}

src/cmd/pack/pack_test.go

+5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"io/fs"
1414
"os"
1515
"path/filepath"
16+
"runtime"
1617
"strings"
1718
"sync"
1819
"testing"
@@ -191,6 +192,7 @@ func TestExtract(t *testing.T) {
191192
// Test that pack-created archives can be understood by the tools.
192193
func TestHello(t *testing.T) {
193194
testenv.MustHaveGoBuild(t)
195+
testenv.MustInternalLink(t, false)
194196

195197
dir := t.TempDir()
196198
hello := filepath.Join(dir, "hello.go")
@@ -413,6 +415,9 @@ func doRun(t *testing.T, dir string, args ...string) string {
413415
cmd.Dir = dir
414416
out, err := cmd.CombinedOutput()
415417
if err != nil {
418+
if t.Name() == "TestHello" && runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
419+
testenv.SkipFlaky(t, 58806)
420+
}
416421
t.Fatalf("%v: %v\n%s", args, err, string(out))
417422
}
418423
return string(out)

src/cmd/pprof/pprof_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ func mustHaveDisasm(t *testing.T) {
7575
}
7676

7777
// Skip PIE platforms, pprof can't disassemble PIE.
78-
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
78+
//
79+
// TODO(#58807): factor this condition out into a function in
80+
// internal/platform so that it won't get out of sync with cmd/go and
81+
// cmd/link.
82+
if (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") || runtime.GOOS == "android" {
7983
t.Skipf("skipping on %s/%s, issue 46639", runtime.GOOS, runtime.GOARCH)
8084
}
8185
}

src/runtime/crash_cgo_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,9 @@ func TestCgoTracebackSigpanic(t *testing.T) {
520520
t.Log(got)
521521
want := "runtime.sigpanic"
522522
if !strings.Contains(got, want) {
523+
if runtime.GOOS == "android" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
524+
testenv.SkipFlaky(t, 58794)
525+
}
523526
t.Errorf("did not see %q in output", want)
524527
}
525528
// No runtime errors like "runtime: unexpected return pc".

0 commit comments

Comments
 (0)