macho tests fail on archs != x86-64
This is on v185, but this likely has been failing this v178:
=================================== FAILURES ===================================
________________________________ test_llvm_diff ________________________________
obj_differences = [<Difference strings -a -n 8 {} -- strings -a -n 8 {} []>, <Difference llvm-readobj --file-headers {} -- llvm-readobj ...llvm-readobj --dyn-symbols {} []>, <Difference llvm-readobj --relocations {} -- llvm-readobj --relocations {} []>, ...]
@skip_unless_tools_exist("llvm-readobj", "llvm-objdump")
def test_llvm_diff(obj_differences):
if llvm_version() < "13":
diff_symbols = "macho_llvm_expected_diff_symbols_llvm_11"
else:
diff_symbols = "macho_llvm_expected_diff_symbols"
# Headers
assert len(obj_differences) == 8
filenames = [
"macho_llvm_expected_diff_strings",
"macho_llvm_expected_diff_file_headers",
"macho_llvm_expected_diff_needed_libs",
diff_symbols,
"macho_llvm_expected_diff_dyn_symbols",
"macho_llvm_expected_diff_relocations",
"macho_llvm_expected_diff_dyn_relocations",
]
for idx, diff in enumerate(obj_differences[:-1]):
assert_diff(diff, filenames[idx])
# Sections
arch_differences = obj_differences[-1].details
> assert len(arch_differences) == 7
E assert 8 == 7
E +8
E -7
arch_differences = [<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__text --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__text --macho --demangle --no-leading-addr --no-show-raw-insn {} []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__stubs --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__stubs --macho --demangle --no-leading-addr --no-show-raw-insn {} []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__stub_helper --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__stub_helper --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__cstring --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__cstring --macho --demangle --no-leading-addr --no-show-raw-insn {} []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__unwind_info --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__unwind_info --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__eh_frame --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__eh_frame --macho --demangle --no-leading-addr --no-show-raw-insn {} []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__DATA,__nl_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__DATA,__nl_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>,
<Difference llvm-objdump --arch-name=x86_64 --section=__DATA,__la_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__DATA,__la_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>]
diff = <Difference llvm-readobj --dyn-relocations {} -- llvm-readobj --dyn-relocations {} []>
diff_symbols = 'macho_llvm_expected_diff_symbols_llvm_11'
filenames = ['macho_llvm_expected_diff_strings',
'macho_llvm_expected_diff_file_headers',
'macho_llvm_expected_diff_needed_libs',
'macho_llvm_expected_diff_symbols_llvm_11',
'macho_llvm_expected_diff_dyn_symbols',
'macho_llvm_expected_diff_relocations',
'macho_llvm_expected_diff_dyn_relocations']
idx = 6
obj_differences = [<Difference strings -a -n 8 {} -- strings -a -n 8 {} []>,
<Difference llvm-readobj --file-headers {} -- llvm-readobj --file-headers {} []>,
<Difference llvm-readobj --needed-libs {} -- llvm-readobj --needed-libs {} []>,
<Difference llvm-readobj --symbols {} -- llvm-readobj --symbols {} []>,
<Difference llvm-readobj --dyn-symbols {} -- llvm-readobj --dyn-symbols {} []>,
<Difference llvm-readobj --relocations {} -- llvm-readobj --relocations {} []>,
<Difference llvm-readobj --dyn-relocations {} -- llvm-readobj --dyn-relocations {} []>,
<Difference x86_64 -- x86_64 [<Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__text --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__text --macho --demangle --no-leading-addr --no-show-raw-insn {} []>, <Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__stubs --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__stubs --macho --demangle --no-leading-addr --no-show-raw-insn {} []>, <Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__stub_helper --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__stub_helper --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>, <Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__cstring --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__cstring --macho --demangle --no-leading-addr --no-show-raw-insn {} []>, <Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__unwind_info --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__unwind_info --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>, <Difference llvm-objdump --arch-name=x86_64 --section=__TEXT,__eh_frame --macho --demangle --no-leading-addr --no-show-raw-insn {} -- llvm-objdump --arch-name=x86_64 --section=__TEXT,__eh_frame --macho --demangle --no-leading-addr --no-show-raw-insn {} []>, <Difference llvm-objdump --arch-name=x86_64 --section=__DATA,__nl_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__DATA,__nl_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>, <Difference llvm-objdump --arch-name=x86_64 --section=__DATA,__la_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] -- llvm-objdump --arch-name=x86_64 --section=__DATA,__la_symbol_ptr --macho --demangle --no-leading-addr --no-show-raw-insn {} […] []>]>]
After looking a bit I noticed that also the comparing files are different, so it's not just an "extra section".
For now I'm going to skip this test in the "wrong" architecture, but would be cool to have it fixed more properly
/cc @JRomain (since you implemented the tests in the first place)