t.Logf("%s", out)
}
if err != nil {
- t.Error(err)
+ t.Log(err)
}
return err
}
}()
wg.Wait()
if errexe != nil || errpie != nil {
+ if runtime.GOOS == "android" && runtime.GOARCH == "arm64" {
+ testenv.SkipFlaky(t, 58806)
+ }
t.Fatal("link failed")
}
}
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
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")
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)
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")
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)
}
}
t.Parallel()
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false)
const source = `
package 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)
}
}
t.Parallel()
testenv.MustHaveGoBuild(t)
+ testenv.MustInternalLink(t, false)
tmpdir := t.TempDir()
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)
}
// 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()
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)
}
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
}
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)
}
"io/fs"
"os"
"path/filepath"
+ "runtime"
"strings"
"sync"
"testing"
// 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")
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)
}
// 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)
}
}
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".