Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test --x86-asm-syntax=intel only on amd64 #561

Merged
merged 11 commits into from
Oct 7, 2020
16 changes: 11 additions & 5 deletions internal/binutils/binutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ func skipUnlessLinuxAmd64(t *testing.T) {

func skipUnlessDarwinAmd64(t *testing.T) {
if runtime.GOOS != "darwin" || runtime.GOARCH != "amd64" {
t.Skip("This test only works on x86-64 Mac")
t.Skip("This test only works on x86-64 macOS")
}
}

Expand All @@ -206,7 +206,7 @@ func testDisasm(t *testing.T, intelSyntax bool) {
}
mainCount := 0
for _, x := range insts {
// Mac symbols have a leading underscore.
// macOS symbols have a leading underscore.
if x.Function == "main" || x.Function == "_main" {
mainCount++
}
Expand All @@ -218,12 +218,18 @@ func testDisasm(t *testing.T, intelSyntax bool) {

func TestDisasm(t *testing.T) {
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
t.Skip("This test only works on Linux or Mac")
t.Skip("This test only works on Linux or macOS")
}
testDisasm(t, true)
testDisasm(t, false)
}

func TestDisasmIntelSyntax(t *testing.T) {
if (runtime.GOOS != "linux" && runtime.GOOS != "darwin") || runtime.GOARCH != "amd64" {
t.Skip("This test only works on x86_64 Linux or macOS as it tests Intel asm syntax")
}
testDisasm(t, true)
}

func findSymbol(syms []*plugin.Sym, name string) *plugin.Sym {
for _, s := range syms {
for _, n := range s.Name {
Expand Down Expand Up @@ -325,7 +331,7 @@ func TestMachoFiles(t *testing.T) {
}
t.Logf("binutils: %v", bu)
if runtime.GOOS == "darwin" && !bu.rep.addr2lineFound && !bu.rep.llvmSymbolizerFound {
// On OSX user needs to install gaddr2line or llvm-symbolizer with
// On macOS, user needs to install gaddr2line or llvm-symbolizer with
// Homebrew, skip the test when the environment doesn't have it
// installed.
t.Skip("couldn't find addr2line or gaddr2line")
Expand Down