Loading tests/comparators/test_elf.py +14 −3 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ from diffoscope.comparators.directory import FilesystemDirectory from diffoscope.comparators.missing_file import MissingFile from diffoscope.comparators.utils.specialize import specialize from ..utils.data import data, load_fixture, assert_diff from ..utils.data import data, load_fixture, get_data, assert_diff from ..utils.tools import ( skip_unless_tools_exist, skip_if_binutils_does_not_support_x86, Loading Loading @@ -169,6 +169,7 @@ def libmix_differences(libmix1, libmix2): @skip_unless_tools_exist("xxd") @skip_unless_tools_exist("llvm-readobj", "llvm-objdump") @skip_unless_tools_exist("readelf", "objdump") @skip_if_tool_version_is("readelf", readelf_version, "2.29") @skip_if_binutils_does_not_support_x86() Loading @@ -178,17 +179,27 @@ def test_libmix_differences(libmix_differences): # Check order and basic identification assert file_list.source1 == "file list" assert "Falling back to binary" in mach_o.comments[0] x86_o = x86_o.details[0] assert x86_o.source1.startswith("objdump ") assert src_c.source1.endswith(".c") mach_o = mach_o.details[0] for diff in mach_o.details: assert diff.source1.startswith("llvm-objdump ") # Content assert "return42_or_3" in file_list.unified_diff assert_diff(mach_o, "elfmix_mach_o_expected_diff") assert_diff(x86_o, "elfmix_disassembly_expected_diff") assert_diff(src_c, "elfmix_src_c_expected_diff") mach_o_filenames = [ "elfmix_mach_o_expected_diff__text", "elfmix_mach_o_expected_diff__compact_unwind", "elfmix_mach_o_expected_diff__eh_frame", ] for idx, diff in enumerate(mach_o.details): assert_diff(diff, mach_o_filenames[idx]) x_obj = x_obj.details[0] if x_obj.source1.startswith("readelf "): assert_diff(x_obj, "elfmix_x_obj_expected_diff") Loading tests/data/elfmix_mach_o_expected_diffdeleted 100644 → 0 +0 −17 Original line number Diff line number Diff line @@ -23,15 +23,15 @@ 00000160: 0100 0000 000e 0a00 000e 0a00 0000 0000 ................ 00000170: 0200 0000 1800 0000 5002 0000 0100 0000 ........P....... 00000180: 6002 0000 1000 0000 0b00 0000 5000 0000 `...........P... 00000190: 0000 0000 0000 0000 0000 0000 0100 0000 ................ 000001a0: 0100 0000 0000 0000 0000 0000 0000 0000 ................ 000001b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000001c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ -000001d0: 0000 0000 0000 0000 5548 89e5 b82a 0000 ........UH...*.. +000001d0: 0000 0000 0000 0000 5548 89e5 b82b 0000 ........UH...+.. 000001e0: 005d c300 0000 0000 0000 0000 0000 0000 .].............. 000001f0: 0b00 0000 0000 0001 0000 0000 0000 0000 ................ 00000200: 0000 0000 0000 0000 1400 0000 0000 0000 ................ 00000210: 017a 5200 0178 1001 100c 0708 9001 0000 .zR..x.......... 00000220: 2400 0000 1c00 0000 b0ff ffff ffff ffff $............... 00000230: 0b00 0000 0000 0000 0041 0e10 8602 430d .........A....C. 00000240: 0600 0000 0000 0000 0000 0000 0100 0006 ................ tests/data/elfmix_mach_o_expected_diff__compact_unwind 0 → 100644 +11 −0 Original line number Diff line number Diff line @@ -1,9 +1,9 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__LD,__compact_unwind) section 0000000000000010 00 00 00 00 00 00 00 00 0b 00 00 00 00 00 00 01 0000000000000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 tests/data/elfmix_mach_o_expected_diff__eh_frame 0 → 100644 +13 −0 Original line number Diff line number Diff line @@ -1,11 +1,11 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__TEXT,__eh_frame) section Unknown section type (0x0000000b) 0000000000000030 14 00 00 00 00 00 00 00 01 7a 52 00 01 78 10 01 0000000000000040 10 0c 07 08 90 01 00 00 24 00 00 00 1c 00 00 00 0000000000000050 b0 ff ff ff ff ff ff ff 0b 00 00 00 00 00 00 00 tests/data/elfmix_mach_o_expected_diff__text 0 → 100644 +16 −0 Original line number Diff line number Diff line @@ -1,13 +1,13 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__TEXT,__text) section _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Loading
tests/comparators/test_elf.py +14 −3 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ from diffoscope.comparators.directory import FilesystemDirectory from diffoscope.comparators.missing_file import MissingFile from diffoscope.comparators.utils.specialize import specialize from ..utils.data import data, load_fixture, assert_diff from ..utils.data import data, load_fixture, get_data, assert_diff from ..utils.tools import ( skip_unless_tools_exist, skip_if_binutils_does_not_support_x86, Loading Loading @@ -169,6 +169,7 @@ def libmix_differences(libmix1, libmix2): @skip_unless_tools_exist("xxd") @skip_unless_tools_exist("llvm-readobj", "llvm-objdump") @skip_unless_tools_exist("readelf", "objdump") @skip_if_tool_version_is("readelf", readelf_version, "2.29") @skip_if_binutils_does_not_support_x86() Loading @@ -178,17 +179,27 @@ def test_libmix_differences(libmix_differences): # Check order and basic identification assert file_list.source1 == "file list" assert "Falling back to binary" in mach_o.comments[0] x86_o = x86_o.details[0] assert x86_o.source1.startswith("objdump ") assert src_c.source1.endswith(".c") mach_o = mach_o.details[0] for diff in mach_o.details: assert diff.source1.startswith("llvm-objdump ") # Content assert "return42_or_3" in file_list.unified_diff assert_diff(mach_o, "elfmix_mach_o_expected_diff") assert_diff(x86_o, "elfmix_disassembly_expected_diff") assert_diff(src_c, "elfmix_src_c_expected_diff") mach_o_filenames = [ "elfmix_mach_o_expected_diff__text", "elfmix_mach_o_expected_diff__compact_unwind", "elfmix_mach_o_expected_diff__eh_frame", ] for idx, diff in enumerate(mach_o.details): assert_diff(diff, mach_o_filenames[idx]) x_obj = x_obj.details[0] if x_obj.source1.startswith("readelf "): assert_diff(x_obj, "elfmix_x_obj_expected_diff") Loading
tests/data/elfmix_mach_o_expected_diffdeleted 100644 → 0 +0 −17 Original line number Diff line number Diff line @@ -23,15 +23,15 @@ 00000160: 0100 0000 000e 0a00 000e 0a00 0000 0000 ................ 00000170: 0200 0000 1800 0000 5002 0000 0100 0000 ........P....... 00000180: 6002 0000 1000 0000 0b00 0000 5000 0000 `...........P... 00000190: 0000 0000 0000 0000 0000 0000 0100 0000 ................ 000001a0: 0100 0000 0000 0000 0000 0000 0000 0000 ................ 000001b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 000001c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................ -000001d0: 0000 0000 0000 0000 5548 89e5 b82a 0000 ........UH...*.. +000001d0: 0000 0000 0000 0000 5548 89e5 b82b 0000 ........UH...+.. 000001e0: 005d c300 0000 0000 0000 0000 0000 0000 .].............. 000001f0: 0b00 0000 0000 0001 0000 0000 0000 0000 ................ 00000200: 0000 0000 0000 0000 1400 0000 0000 0000 ................ 00000210: 017a 5200 0178 1001 100c 0708 9001 0000 .zR..x.......... 00000220: 2400 0000 1c00 0000 b0ff ffff ffff ffff $............... 00000230: 0b00 0000 0000 0000 0041 0e10 8602 430d .........A....C. 00000240: 0600 0000 0000 0000 0000 0000 0100 0006 ................
tests/data/elfmix_mach_o_expected_diff__compact_unwind 0 → 100644 +11 −0 Original line number Diff line number Diff line @@ -1,9 +1,9 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__LD,__compact_unwind) section 0000000000000010 00 00 00 00 00 00 00 00 0b 00 00 00 00 00 00 01 0000000000000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
tests/data/elfmix_mach_o_expected_diff__eh_frame 0 → 100644 +13 −0 Original line number Diff line number Diff line @@ -1,11 +1,11 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__TEXT,__eh_frame) section Unknown section type (0x0000000b) 0000000000000030 14 00 00 00 00 00 00 00 01 7a 52 00 01 78 10 01 0000000000000040 10 0c 07 08 90 01 00 00 24 00 00 00 1c 00 00 00 0000000000000050 b0 ff ff ff ff ff ff ff 0b 00 00 00 00 00 00 00
tests/data/elfmix_mach_o_expected_diff__text 0 → 100644 +16 −0 Original line number Diff line number Diff line @@ -1,13 +1,13 @@ _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq Contents of (__TEXT,__text) section _return42_or_3: pushq %rbp movq %rsp, %rbp - movl $42, %eax + movl $43, %eax popq %rbp retq