mirror of
https://github.com/golang/go
synced 2024-11-23 11:10:04 -07:00
cmd/objdump: skip tests on unsupported platforms
Should fix mips(64)(le) and s390x builds. Change-Id: I2c80339ce22b0ce5dceb595e504740e74bc840cd Reviewed-on: https://go-review.googlesource.com/c/go/+/263137 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Jeremy Faller <jeremy@golang.org>
This commit is contained in:
parent
606d4a38b9
commit
e7259c07d4
@ -106,6 +106,17 @@ var ppcGnuNeed = []string{
|
|||||||
"cmpw",
|
"cmpw",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func mustHaveDisasm(t *testing.T) {
|
||||||
|
switch runtime.GOARCH {
|
||||||
|
case "mips", "mipsle", "mips64", "mips64le":
|
||||||
|
t.Skipf("skipping on %s, issue 12559", runtime.GOARCH)
|
||||||
|
case "riscv64":
|
||||||
|
t.Skipf("skipping on %s, issue 36738", runtime.GOARCH)
|
||||||
|
case "s390x":
|
||||||
|
t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var target = flag.String("target", "", "test disassembly of `goos/goarch` binary")
|
var target = flag.String("target", "", "test disassembly of `goos/goarch` binary")
|
||||||
|
|
||||||
// objdump is fully cross platform: it can handle binaries
|
// objdump is fully cross platform: it can handle binaries
|
||||||
@ -118,6 +129,7 @@ var target = flag.String("target", "", "test disassembly of `goos/goarch` binary
|
|||||||
// can handle that one.
|
// can handle that one.
|
||||||
|
|
||||||
func testDisasm(t *testing.T, srcfname string, printCode bool, printGnuAsm bool, flags ...string) {
|
func testDisasm(t *testing.T, srcfname string, printCode bool, printGnuAsm bool, flags ...string) {
|
||||||
|
mustHaveDisasm(t)
|
||||||
goarch := runtime.GOARCH
|
goarch := runtime.GOARCH
|
||||||
if *target != "" {
|
if *target != "" {
|
||||||
f := strings.Split(*target, "/")
|
f := strings.Split(*target, "/")
|
||||||
@ -227,71 +239,36 @@ func testGoAndCgoDisasm(t *testing.T, printCode bool, printGnuAsm bool) {
|
|||||||
testDisasm(t, "fmthello.go", printCode, printGnuAsm)
|
testDisasm(t, "fmthello.go", printCode, printGnuAsm)
|
||||||
if build.Default.CgoEnabled {
|
if build.Default.CgoEnabled {
|
||||||
if runtime.GOOS == "aix" {
|
if runtime.GOOS == "aix" {
|
||||||
t.Skipf("skipping on %s, issue 40972", runtime.GOOS)
|
return // issue 40972
|
||||||
}
|
}
|
||||||
testDisasm(t, "fmthellocgo.go", printCode, printGnuAsm)
|
testDisasm(t, "fmthellocgo.go", printCode, printGnuAsm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisasm(t *testing.T) {
|
func TestDisasm(t *testing.T) {
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "mips", "mipsle", "mips64", "mips64le":
|
|
||||||
t.Skipf("skipping on %s, issue 12559", runtime.GOARCH)
|
|
||||||
case "riscv64":
|
|
||||||
t.Skipf("skipping on %s, issue 36738", runtime.GOARCH)
|
|
||||||
case "s390x":
|
|
||||||
t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
|
|
||||||
}
|
|
||||||
testGoAndCgoDisasm(t, false, false)
|
testGoAndCgoDisasm(t, false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisasmCode(t *testing.T) {
|
func TestDisasmCode(t *testing.T) {
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "mips", "mipsle", "mips64", "mips64le", "riscv64", "s390x":
|
|
||||||
t.Skipf("skipping on %s, issue 19160", runtime.GOARCH)
|
|
||||||
}
|
|
||||||
testGoAndCgoDisasm(t, true, false)
|
testGoAndCgoDisasm(t, true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisasmGnuAsm(t *testing.T) {
|
func TestDisasmGnuAsm(t *testing.T) {
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "mips", "mipsle", "mips64", "mips64le", "riscv64", "s390x":
|
|
||||||
t.Skipf("skipping on %s, issue 19160", runtime.GOARCH)
|
|
||||||
}
|
|
||||||
testGoAndCgoDisasm(t, false, true)
|
testGoAndCgoDisasm(t, false, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisasmExtld(t *testing.T) {
|
func TestDisasmExtld(t *testing.T) {
|
||||||
|
testenv.MustHaveCGO(t)
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
case "plan9", "windows":
|
case "plan9", "windows":
|
||||||
t.Skipf("skipping on %s", runtime.GOOS)
|
t.Skipf("skipping on %s", runtime.GOOS)
|
||||||
}
|
}
|
||||||
switch runtime.GOARCH {
|
|
||||||
case "ppc64":
|
|
||||||
t.Skipf("skipping on %s, no support for external linking, issue 9038", runtime.GOARCH)
|
|
||||||
case "mips64", "mips64le", "mips", "mipsle":
|
|
||||||
t.Skipf("skipping on %s, issue 12559 and 12560", runtime.GOARCH)
|
|
||||||
case "riscv64":
|
|
||||||
t.Skipf("skipping on %s, no support for external linking, issue 36739", runtime.GOARCH)
|
|
||||||
case "s390x":
|
|
||||||
t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
|
|
||||||
}
|
|
||||||
if !build.Default.CgoEnabled {
|
|
||||||
t.Skip("skipping because cgo is not enabled")
|
|
||||||
}
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testDisasm(t, "fmthello.go", false, false, "-ldflags=-linkmode=external")
|
testDisasm(t, "fmthello.go", false, false, "-ldflags=-linkmode=external")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDisasmGoobj(t *testing.T) {
|
func TestDisasmGoobj(t *testing.T) {
|
||||||
switch runtime.GOARCH {
|
mustHaveDisasm(t)
|
||||||
case "mips", "mipsle", "mips64", "mips64le":
|
|
||||||
t.Skipf("skipping on %s, issue 12559", runtime.GOARCH)
|
|
||||||
case "riscv64":
|
|
||||||
t.Skipf("skipping on %s, issue 36738", runtime.GOARCH)
|
|
||||||
case "s390x":
|
|
||||||
t.Skipf("skipping on %s, issue 15255", runtime.GOARCH)
|
|
||||||
}
|
|
||||||
|
|
||||||
hello := filepath.Join(tmp, "hello.o")
|
hello := filepath.Join(tmp, "hello.o")
|
||||||
args := []string{"tool", "compile", "-o", hello}
|
args := []string{"tool", "compile", "-o", hello}
|
||||||
@ -337,6 +314,7 @@ func TestDisasmGoobj(t *testing.T) {
|
|||||||
func TestGoobjFileNumber(t *testing.T) {
|
func TestGoobjFileNumber(t *testing.T) {
|
||||||
// Test that file table in Go object file is parsed correctly.
|
// Test that file table in Go object file is parsed correctly.
|
||||||
testenv.MustHaveGoBuild(t)
|
testenv.MustHaveGoBuild(t)
|
||||||
|
mustHaveDisasm(t)
|
||||||
|
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user