]> Cypherpunks repositories - gostls13.git/commitdiff
all: skip tests that fail on android/arm64
authorBryan C. Mills <bcmills@google.com>
Wed, 1 Mar 2023 13:45:18 +0000 (13:45 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 10 Mar 2023 20:38:29 +0000 (20:38 +0000)
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>

src/cmd/link/elf_test.go
src/cmd/link/internal/ld/dwarf_test.go
src/cmd/link/internal/ld/ld_test.go
src/cmd/link/link_test.go
src/cmd/nm/nm_test.go
src/cmd/pack/pack_test.go
src/cmd/pprof/pprof_test.go
src/runtime/crash_cgo_test.go

index 27285ff566ead9023f825ec8a12ac7664f29b4d0..d6621458473f0dde30b85f4a6968ed74d4a9f24d 100644 (file)
@@ -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")
                        }
 
index ee3ea9d175b4ff4d27988fc780b1755104a925d8..abbfec0c412e52314ba27ae627d09bad605614b2 100644 (file)
@@ -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")
index 22bc11eff3d41da03e59bbf497cc580239351112..aef880d5341c2111b73c37ec42f857c6a2a41378 100644 (file)
@@ -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)
                }
        }
index 121ef958532fbcd44c621e7fbb724e7cb3762cba..72dbca5c63e5e406632b920cfcb313eeba132c69 100644 (file)
@@ -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)
        }
 
index 7d8358e294dd28f74b177f177987a695b47f66d2..014a5d2bd75f12f4b618f35572ade50823d256b5 100644 (file)
@@ -165,6 +165,14 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
                                return true
                        }
                }
+               // Code is always relocated if the default buildmode is PIE.
+               //
+               // TODO(#58807): factor this condition out into a function in
+               // internal/platform so that it won't get out of sync with cmd/go and
+               // cmd/link.
+               if runtime.GOOS == "android" {
+                       return true
+               }
                if runtime.GOOS == "windows" {
                        return true
                }
@@ -198,7 +206,12 @@ func testGoExec(t *testing.T, iscgo, isexternallinker bool) {
                                stype = "D"
                        }
                        if want, have := stype, strings.ToUpper(f[1]); have != want {
-                               t.Errorf("want %s type for %s symbol, but have %s", want, name, have)
+                               if runtime.GOOS == "android" && name == "runtime.epclntab" && have == "D" {
+                                       // TODO(#58807): Figure out why this fails and fix up the test.
+                                       t.Logf("(ignoring on %s) want %s type for %s symbol, but have %s", runtime.GOOS, want, name, have)
+                               } else {
+                                       t.Errorf("want %s type for %s symbol, but have %s", want, name, have)
+                               }
                        }
                        delete(runtimeSyms, name)
                }
index 5534a10b37f3cd28b5d2d40cc77a04b105ca8195..309139aa4dd8e6c18de4846f392f8be5d68a65f4 100644 (file)
@@ -13,6 +13,7 @@ import (
        "io/fs"
        "os"
        "path/filepath"
+       "runtime"
        "strings"
        "sync"
        "testing"
@@ -191,6 +192,7 @@ func TestExtract(t *testing.T) {
 // Test that pack-created archives can be understood by the tools.
 func TestHello(t *testing.T) {
        testenv.MustHaveGoBuild(t)
+       testenv.MustInternalLink(t, false)
 
        dir := t.TempDir()
        hello := filepath.Join(dir, "hello.go")
@@ -413,6 +415,9 @@ func doRun(t *testing.T, dir string, args ...string) string {
        cmd.Dir = dir
        out, err := cmd.CombinedOutput()
        if err != nil {
+               if t.Name() == "TestHello" && runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+                       testenv.SkipFlaky(t, 58806)
+               }
                t.Fatalf("%v: %v\n%s", args, err, string(out))
        }
        return string(out)
index 353781ac0452a3323994aef44ebf41dbd4f4dc4e..d6ca0e28da79fc9721c3e5e7b7abb2d6f5cc356a 100644 (file)
@@ -75,7 +75,11 @@ func mustHaveDisasm(t *testing.T) {
        }
 
        // Skip PIE platforms, pprof can't disassemble PIE.
-       if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
+       //
+       // TODO(#58807): factor this condition out into a function in
+       // internal/platform so that it won't get out of sync with cmd/go and
+       // cmd/link.
+       if (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") || runtime.GOOS == "android" {
                t.Skipf("skipping on %s/%s, issue 46639", runtime.GOOS, runtime.GOARCH)
        }
 }
index 51d7bb50915d8e257496e33e1838c5830927ff33..65556edd2ac27af48441401502114a69bb654fed 100644 (file)
@@ -520,6 +520,9 @@ func TestCgoTracebackSigpanic(t *testing.T) {
        t.Log(got)
        want := "runtime.sigpanic"
        if !strings.Contains(got, want) {
+               if runtime.GOOS == "android" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
+                       testenv.SkipFlaky(t, 58794)
+               }
                t.Errorf("did not see %q in output", want)
        }
        // No runtime errors like "runtime: unexpected return pc".