mirror of
https://github.com/golang/go
synced 2024-11-18 12:04:57 -07:00
cmd/objdump: enable tests on ppc64/ppc64le
Fixes #9039. Change-Id: I7d213b4f8e4cda73ea7687fb97dbd22e58163949 Reviewed-on: https://go-review.googlesource.com/9683 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
94cf54e861
commit
0a55a16c91
@ -5,6 +5,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"go/build"
|
"go/build"
|
||||||
"internal/testenv"
|
"internal/testenv"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@ -49,6 +50,16 @@ var armNeed = []string{
|
|||||||
"RET",
|
"RET",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ppcNeed = []string{
|
||||||
|
"fmthello.go:6",
|
||||||
|
"TEXT main.main(SB)",
|
||||||
|
"BR main.main(SB)",
|
||||||
|
"BL fmt.Println(SB)",
|
||||||
|
"RET",
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
// from any known operating system and architecture.
|
// from any known operating system and architecture.
|
||||||
// We could in principle add binaries to testdata and check
|
// We could in principle add binaries to testdata and check
|
||||||
@ -62,6 +73,19 @@ func testDisasm(t *testing.T, flags ...string) {
|
|||||||
tmp, exe := buildObjdump(t)
|
tmp, exe := buildObjdump(t)
|
||||||
defer os.RemoveAll(tmp)
|
defer os.RemoveAll(tmp)
|
||||||
|
|
||||||
|
goarch := runtime.GOARCH
|
||||||
|
if *target != "" {
|
||||||
|
f := strings.Split(*target, "/")
|
||||||
|
if len(f) != 2 {
|
||||||
|
t.Fatalf("-target argument must be goos/goarch")
|
||||||
|
}
|
||||||
|
defer os.Setenv("GOOS", os.Getenv("GOOS"))
|
||||||
|
defer os.Setenv("GOARCH", os.Getenv("GOARCH"))
|
||||||
|
os.Setenv("GOOS", f[0])
|
||||||
|
os.Setenv("GOARCH", f[1])
|
||||||
|
goarch = f[1]
|
||||||
|
}
|
||||||
|
|
||||||
hello := filepath.Join(tmp, "hello.exe")
|
hello := filepath.Join(tmp, "hello.exe")
|
||||||
args := []string{"build", "-o", hello}
|
args := []string{"build", "-o", hello}
|
||||||
args = append(args, flags...)
|
args = append(args, flags...)
|
||||||
@ -74,11 +98,13 @@ func testDisasm(t *testing.T, flags ...string) {
|
|||||||
"fmthello.go:6",
|
"fmthello.go:6",
|
||||||
"TEXT main.main(SB)",
|
"TEXT main.main(SB)",
|
||||||
}
|
}
|
||||||
switch runtime.GOARCH {
|
switch goarch {
|
||||||
case "amd64", "386":
|
case "amd64", "386":
|
||||||
need = append(need, x86Need...)
|
need = append(need, x86Need...)
|
||||||
case "arm":
|
case "arm":
|
||||||
need = append(need, armNeed...)
|
need = append(need, armNeed...)
|
||||||
|
case "ppc64", "ppc64le":
|
||||||
|
need = append(need, ppcNeed...)
|
||||||
}
|
}
|
||||||
|
|
||||||
out, err = exec.Command(exe, "-s", "main.main", hello).CombinedOutput()
|
out, err = exec.Command(exe, "-s", "main.main", hello).CombinedOutput()
|
||||||
@ -101,8 +127,6 @@ func testDisasm(t *testing.T, flags ...string) {
|
|||||||
|
|
||||||
func TestDisasm(t *testing.T) {
|
func TestDisasm(t *testing.T) {
|
||||||
switch runtime.GOARCH {
|
switch runtime.GOARCH {
|
||||||
case "ppc64", "ppc64le":
|
|
||||||
t.Skipf("skipping on %s, issue 9039", runtime.GOARCH)
|
|
||||||
case "arm64":
|
case "arm64":
|
||||||
t.Skipf("skipping on %s, issue 10106", runtime.GOARCH)
|
t.Skipf("skipping on %s, issue 10106", runtime.GOARCH)
|
||||||
case "mips64", "mips64le":
|
case "mips64", "mips64le":
|
||||||
|
Loading…
Reference in New Issue
Block a user