aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2023-03-01 13:45:18 +0000
committerGopher Robot <gobot@golang.org>2023-03-10 20:38:29 +0000
commitd12fe60004ae5e4024c8a93f4f7de7183bb61576 (patch)
tree1f3e0ac455b4f30cb9699dcec94f939b2708f6c0 /src/cmd/link
parent2cbab4e98c6091f5fb6cb73bdebfe328793da388 (diff)
downloadgo-d12fe60004ae5e4024c8a93f4f7de7183bb61576.tar.xz
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 <cherryyz@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/elf_test.go5
-rw-r--r--src/cmd/link/internal/ld/dwarf_test.go18
-rw-r--r--src/cmd/link/internal/ld/ld_test.go3
-rw-r--r--src/cmd/link/link_test.go12
4 files changed, 32 insertions, 6 deletions
diff --git a/src/cmd/link/elf_test.go b/src/cmd/link/elf_test.go
index 27285ff566..d662145847 100644
--- a/src/cmd/link/elf_test.go
+++ b/src/cmd/link/elf_test.go
@@ -340,7 +340,7 @@ func TestPIESize(t *testing.T) {
t.Logf("%s", out)
}
if err != nil {
- t.Error(err)
+ t.Log(err)
}
return err
}
@@ -358,6 +358,9 @@ func TestPIESize(t *testing.T) {
}()
wg.Wait()
if errexe != nil || errpie != nil {
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58806)
+ }
t.Fatal("link failed")
}
diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go
index ee3ea9d175..abbfec0c41 100644
--- a/src/cmd/link/internal/ld/dwarf_test.go
+++ b/src/cmd/link/internal/ld/dwarf_test.go
@@ -227,7 +227,10 @@ func main() {
}
switch entry.Tag {
case dwarf.TagStructType:
- name := entry.Val(dwarf.AttrName).(string)
+ name, ok := entry.Val(dwarf.AttrName).(string)
+ if !ok {
+ continue
+ }
wantMembers := want[name]
if wantMembers == nil {
continue
@@ -888,8 +891,10 @@ func TestRuntimeTypeAttrInternal(t *testing.T) {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
}
- if runtime.GOOS == "windows" {
- t.Skip("skipping on windows; test is incompatible with relocatable binaries")
+ // TODO(#58807): factor this condition out into a function in
+ // internal/platform so that it won't get out of sync with cmd/link.
+ if runtime.GOOS == "android" || runtime.GOOS == "windows" {
+ t.Skipf("skipping on %s; test is incompatible with relocatable binaries", runtime.GOOS)
}
testRuntimeTypeAttr(t, "-ldflags=-linkmode=internal")
@@ -980,8 +985,10 @@ func main() {
t.Fatalf("*main.X DIE had no runtime type attr. DIE: %v", dies[0])
}
- if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
- return // everything is PIE on ARM64, addresses are relocated
+ // TODO(#58807): factor this condition out into a function in
+ // internal/platform so that it won't get out of sync with cmd/link.
+ if (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") || runtime.GOOS == "android" {
+ return // everything is PIE, addresses are relocated
}
if rtAttr.(uint64)+types.Addr != addr {
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) {
func TestIssue42484(t *testing.T) {
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false) // Avoid spurious failures from external linkers.
if runtime.GOOS == "plan9" {
t.Skip("skipping on plan9; no DWARF symbol table in executables")
diff --git a/src/cmd/link/internal/ld/ld_test.go b/src/cmd/link/internal/ld/ld_test.go
index 22bc11eff3..aef880d534 100644
--- a/src/cmd/link/internal/ld/ld_test.go
+++ b/src/cmd/link/internal/ld/ld_test.go
@@ -65,6 +65,9 @@ func TestUndefinedRelocErrors(t *testing.T) {
case n > 0:
t.Errorf("unmatched error: %s (x%d)", want, n)
case n < 0:
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58807)
+ }
t.Errorf("extra errors: %s (x%d)", want, -n)
}
}
diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index 121ef95853..72dbca5c63 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -41,6 +41,7 @@ func TestIssue21703(t *testing.T) {
t.Parallel()
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false)
const source = `
package main
@@ -70,6 +71,9 @@ func main() {}
cmd.Dir = tmpdir
out, err = cmd.CombinedOutput()
if err != nil {
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58806)
+ }
t.Fatalf("failed to link main.o: %v, output: %s\n", err, out)
}
}
@@ -82,6 +86,7 @@ func TestIssue28429(t *testing.T) {
t.Parallel()
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false)
tmpdir := t.TempDir()
@@ -97,6 +102,9 @@ func TestIssue28429(t *testing.T) {
cmd.Dir = tmpdir
out, err := cmd.CombinedOutput()
if err != nil {
+ if len(args) >= 2 && args[1] == "link" && runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58806)
+ }
t.Fatalf("'go %s' failed: %v, output: %s",
strings.Join(args, " "), err, out)
}
@@ -763,6 +771,7 @@ func TestIndexMismatch(t *testing.T) {
// This shouldn't happen with "go build". We invoke the compiler and the linker
// manually, and try to "trick" the linker with an inconsistent object file.
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false)
t.Parallel()
@@ -797,6 +806,9 @@ func TestIndexMismatch(t *testing.T) {
t.Log(cmd)
out, err = cmd.CombinedOutput()
if err != nil {
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58806)
+ }
t.Errorf("linking failed: %v\n%s", err, out)
}