capstone-rs
capstone-rs copied to clipboard
test failures on big endian.
Automated testing in debian showed that the tests for the capstone crate failed on s390x (64-bit big endian)
https://ci.debian.net/data/autopkgtest/testing/s390x/r/rust-capstone/27661170/log.gz
failures:
---- test::test_arch_m68k_detail stdout ----
thread 'test::test_arch_m68k_detail' panicked at 'assertion failed: `(left == right)`
left: `[M68kOperand(FpSingle(3.1415)), M68kOperand(Reg(RegId(17)))]`,
right: `[M68kOperand(FpSingle(0.0)), M68kOperand(Reg(RegId(17)))]`: operands do not match for "0x1020: fadd.s #0.000000, fp0" (bytes=[f2, 3c, 44, 22, 40, 49, 0e, 56])', src/test.rs:254:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.61.0/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.61.0/library/core/src/panicking.rs:143:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.61.0/library/core/src/panicking.rs:182:5
4: capstone::test::test_instruction_detail_helper
at ./src/test.rs:254:5
5: capstone::test::instructions_match_detail
at ./src/test.rs:445:9
6: capstone::test::test_arch_mode_endian_insns_detail
at ./src/test.rs:595:5
7: capstone::test::test_arch_m68k_detail
at ./src/test.rs:1781:5
8: capstone::test::test_arch_m68k_detail::{{closure}}
at ./src/test.rs:1760:1
9: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.61.0/library/core/src/ops/function.rs:227:5
10: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.61.0/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- test::test_arch_tms320c64x_detail stdout ----
thread 'test::test_arch_tms320c64x_detail' panicked at 'assertion failed: `(left == right)`
left: `"NOP"`,
right: `"nop"`: Did not match contained insn.mnemonic', src/test.rs:233:5
stack backtrace:
0: rust_begin_unwind
at /usr/src/rustc-1.61.0/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /usr/src/rustc-1.61.0/library/core/src/panicking.rs:143:14
2: core::panicking::assert_failed_inner
3: core::panicking::assert_failed
at /usr/src/rustc-1.61.0/library/core/src/panicking.rs:182:5
4: capstone::test::test_instruction_detail_helper
at ./src/test.rs:233:5
5: capstone::test::instructions_match_detail
at ./src/test.rs:445:9
6: capstone::test::test_arch_mode_endian_insns_detail
at ./src/test.rs:595:5
7: capstone::test::test_arch_tms320c64x_detail
at ./src/test.rs:2471:5
8: capstone::test::test_arch_tms320c64x_detail::{{closure}}
at ./src/test.rs:2461:1
9: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.61.0/library/core/src/ops/function.rs:227:5
10: core::ops::function::FnOnce::call_once
at /usr/src/rustc-1.61.0/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
To determine whether these issues were still present in the latest git version of the capstone crate, whether these tests were specific to s390x or more general endian issues and whether 32-bit vs 64 made any difference I ran manual tests on powerpc (32-bit big endian) and ppc64 (64-bit big endian) with the latest version of capstone-rs from git.
The tests on ppc64 gave the same results as the automatic tests from Debian. The tests on powerpc gave a very different failure, a much larger number of tests failed, but they all failed with the same error.
---- arch::m68k::test::extra_info stdout ----
thread 'arch::m68k::test::extra_info' panicked at 'Failed to create Capstone: InvalidMode', capstone-rs/src/arch/m68k.rs:646:14
All tests were performed with rustc 1.61 from Debian.