capstone-rust / capstone-rs

high-level Capstone system bindings for Rust
220 stars 78 forks source link

attempt to fix tests on mac (does not work) #28

Closed seanpont closed 6 years ago

seanpont commented 6 years ago

This change was intended to ensure that archs_enable() was only ever called once, the assumption being that multiple concurrent calls to archs_enable() might be causing the tests to fail on osx. Unfortunately, it did not work. Tests continue to be flaky.

➜  capstone-rs git:(master) ✗ cargo test
   Compiling capstone v0.2.0 (file:///Users/tron/Code/rust/capstone-rs)
    Finished dev [unoptimized + debuginfo] target(s) in 2.56 secs
     Running target/debug/deps/capstone-283a9278dd691db2

running 24 tests
test constants::test::test_cs_mode_size ... ok
test capstone::test::test_set_extra_mode ... ok
test test::test_arch_xcore ... ok
test test::test_arm64_none ... ok
test test::test_arch_systemz ... ok
test test::test_arch_ppc ... ok
test test::test_capstone_is_diet ... ok
test test::test_arch_sparc ... ok
test test::test_arch_mips ... ok
test test::test_capstone_supports_arch ... ok
test test::test_capstone_version ... ok
test test::test_arch_arm64 ... ok
test test::test_invalid_mode ... ok
test test::test_invalid_syntax ... ok
test test::test_extra_mode ... ok
test test::test_arm_simple ... ok
test test::test_x86_names ... ok
test test::test_arch_arm ... ok
test test::test_detail_false_fail ... ok
test test::test_x86_simple ... ok
test test::test_detail_true ... ok
test test::test_arch_x86 ... ok
test test::test_instruction_group_ids ... FAILED
test test::test_syntax ... ok

failures:

---- test::test_instruction_group_ids stdout ----
    thread 'test::test_instruction_group_ids' panicked at 'index 207 out of range for slice of length 8', src/libcore/slice/mod.rs:748:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

failures:
    test::test_instruction_group_ids

test result: FAILED. 23 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'
➜  capstone-rs git:(master) ✗ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/capstone-283a9278dd691db2

running 24 tests
test constants::test::test_cs_mode_size ... ok
test capstone::test::test_set_extra_mode ... ok
test test::test_arch_systemz ... ok
test test::test_arch_xcore ... ok
test test::test_arch_ppc ... ok
test test::test_arch_mips ... ok
test test::test_arm64_none ... ok
test test::test_arch_sparc ... ok
test test::test_arm_simple ... ok
test test::test_capstone_is_diet ... ok
test test::test_arch_arm64 ... ok
test test::test_capstone_supports_arch ... ok
test test::test_capstone_version ... ok
test test::test_detail_false_fail ... ok
test test::test_detail_true ... ok
test test::test_extra_mode ... ok
test test::test_arch_x86 ... ok
test test::test_invalid_mode ... ok
test test::test_invalid_syntax ... ok
test test::test_arch_arm ... ok
test test::test_x86_names ... ok
test test::test_x86_simple ... ok
test test::test_instruction_group_ids ... ok
test test::test_syntax ... ok

test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests capstone

running 4 tests
test src/lib.rs - prelude (line 65) ... ok
test src/capstone.rs - capstone::Capstone::new (line 99) ... ok
test src/capstone.rs - capstone::Capstone::new_raw (line 110) ... ok
test src/lib.rs -  (line 9) ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

➜  capstone-rs git:(master) ✗ cargo test
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/capstone-283a9278dd691db2

running 24 tests
test constants::test::test_cs_mode_size ... ok
test capstone::test::test_set_extra_mode ... ok
test test::test_arch_ppc ... ok
test test::test_arch_mips ... ok
test test::test_arch_sparc ... ok
test test::test_arch_arm64 ... ok
test test::test_arch_systemz ... ok
test test::test_arm64_none ... ok
test test::test_arm_simple ... ok
test test::test_arch_xcore ... ok
test test::test_capstone_is_diet ... ok
test test::test_capstone_supports_arch ... ok
test test::test_capstone_version ... ok
test test::test_detail_false_fail ... ok
test test::test_extra_mode ... ok
test test::test_detail_true ... ok
test test::test_invalid_mode ... ok
test test::test_arch_x86 ... ok
test test::test_invalid_syntax ... ok
test test::test_arch_arm ... ok
test test::test_x86_names ... ok
test test::test_x86_simple ... ok
test test::test_instruction_group_ids ... FAILED
test test::test_syntax ... ok

failures:

---- test::test_instruction_group_ids stdout ----
    thread 'test::test_instruction_group_ids' panicked at 'Expected groups {2} does NOT match computed insn groups {111, 110} with ', src/lib.rs:287:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

failures:
    test::test_instruction_group_ids

test result: FAILED. 23 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--lib'
tmfink commented 6 years ago

Attempts to address Issue #26 . Cherry-picked in PR #35.