Commit e9983165 authored by Russ Cox's avatar Russ Cox

cmd/vendor/golang.org/x/arch: import latest (Aug 18 2017 ffd22fb365cd)

Fixes #21486.

Change-Id: I01794f008404f0e2d8a1408309ae6055513c5b49
Reviewed-on: https://go-review.googlesource.com/57030
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: 's avatarCherry Zhang <cherryyz@google.com>
parent 9f5f51af
...@@ -503,7 +503,7 @@ func JSONCases(t *testing.T) func(func([]byte)) { ...@@ -503,7 +503,7 @@ func JSONCases(t *testing.T) func(func([]byte)) {
return func(try func([]byte)) { return func(try func([]byte)) {
data, err := ioutil.ReadFile("inst.json") data, err := ioutil.ReadFile("inst.json")
if err != nil { if err != nil {
log.Fatal(err) t.Fatal(err)
} }
var insts []InstJson var insts []InstJson
var instsN []InstJson var instsN []InstJson
...@@ -513,7 +513,7 @@ func JSONCases(t *testing.T) func(func([]byte)) { ...@@ -513,7 +513,7 @@ func JSONCases(t *testing.T) func(func([]byte)) {
N = 16 N = 16
} }
if err := json.Unmarshal(data, &insts); err != nil { if err := json.Unmarshal(data, &insts); err != nil {
log.Fatal(err) t.Fatal(err)
} }
// Append instructions to get more test cases. // Append instructions to get more test cases.
for i := 0; i < N; { for i := 0; i < N; {
......
...@@ -27,27 +27,19 @@ func testObjdumpARM64(t *testing.T, generate func(func([]byte))) { ...@@ -27,27 +27,19 @@ func testObjdumpARM64(t *testing.T, generate func(func([]byte))) {
} }
func testObjdumpArch(t *testing.T, generate func(func([]byte)), arch Mode) { func testObjdumpArch(t *testing.T, generate func(func([]byte)), arch Mode) {
if _, err := os.Stat(objdumpPath); err != nil { checkObjdumpAarch64(t)
t.Skip(err)
}
// Check objdump can disassemble elf64-aarch64.
if test := objdumpinfo(); test == false {
t.Skip("Skip the test if installed objdump doesn't support aarch64 elf format")
}
testExtDis(t, "gnu", arch, objdump, generate, allowedMismatchObjdump) testExtDis(t, "gnu", arch, objdump, generate, allowedMismatchObjdump)
testExtDis(t, "plan9", arch, objdump, generate, allowedMismatchObjdump) testExtDis(t, "plan9", arch, objdump, generate, allowedMismatchObjdump)
} }
func objdumpinfo() bool { func checkObjdumpAarch64(t *testing.T) {
var i = []byte("aarch64")
out, err := exec.Command(objdumpPath, "-i").Output() out, err := exec.Command(objdumpPath, "-i").Output()
if err != nil { if err != nil {
log.Fatal(err) t.Skip("cannot run objdump: %v\n%s", err, out)
} }
if bytes.Contains(out, i) { if !strings.Contains(string(out), "aarch64") {
return true t.Skip("objdump does not have aarch64 support")
} }
return false
} }
func objdump(ext *ExtDis) error { func objdump(ext *ExtDis) error {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment