From 685ce723ddf0bd9dcc0998f44a73f5ae07fdc0c5 Mon Sep 17 00:00:00 2001 From: iximeow Date: Wed, 5 Feb 2020 23:30:47 -0800 Subject: bump yaxpeax-arch to 0.0.3, make tests stable-friendly --- test/armv7.rs | 18 ++++++++++-------- test/armv8/a64.rs | 19 +++++++++++-------- test/test.rs | 6 +++--- 3 files changed, 24 insertions(+), 19 deletions(-) (limited to 'test') diff --git a/test/armv7.rs b/test/armv7.rs index f16a44a..2a7ebe0 100644 --- a/test/armv7.rs +++ b/test/armv7.rs @@ -248,7 +248,7 @@ fn test_decode_mul() { ); } -static instruction_bytes: [u8; 4 * 60] = [ +static INSTRUCTION_BYTES: [u8; 4 * 60] = [ 0x24, 0xc0, 0x9f, 0xe5, 0x00, 0xb0, 0xa0, 0xe3, 0x04, 0x10, 0x9d, 0xe4, @@ -315,14 +315,14 @@ static instruction_bytes: [u8; 4 * 60] = [ #[test] fn test_decode_span() { let mut i = 0u32; - while i < instruction_bytes.len() as u32 { - let instr = ::Decoder::default().decode(instruction_bytes[(i as usize)..].iter().cloned()).unwrap(); + while i < INSTRUCTION_BYTES.len() as u32 { + let instr = ::Decoder::default().decode(INSTRUCTION_BYTES[(i as usize)..].iter().cloned()).unwrap(); println!( "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n {}", - instruction_bytes[i as usize], - instruction_bytes[i as usize + 1], - instruction_bytes[i as usize + 2], - instruction_bytes[i as usize + 3], + INSTRUCTION_BYTES[i as usize], + INSTRUCTION_BYTES[i as usize + 1], + INSTRUCTION_BYTES[i as usize + 2], + INSTRUCTION_BYTES[i as usize + 3], // instr, instr); i += instr.len(); @@ -393,12 +393,13 @@ fn test_decode_span() { * 0x0001bfd0 000053e3 cmp r3, 0 */ +/* use test::Bencher; #[bench] pub fn bench_60000_instrs(b: &mut Bencher) { b.iter(|| { for i in (0..1000) { - let mut iter = instruction_bytes.iter().map(|x| *x); + let mut iter = INSTRUCTION_BYTES.iter().map(|x| *x); let decoder = ::Decoder::default(); let mut result = Instruction::default(); loop { @@ -414,3 +415,4 @@ pub fn bench_60000_instrs(b: &mut Bencher) { } }); } +*/ diff --git a/test/armv8/a64.rs b/test/armv8/a64.rs index be2c5bf..90e6d6a 100644 --- a/test/armv8/a64.rs +++ b/test/armv8/a64.rs @@ -119,6 +119,7 @@ fn test_decode_misc() { ); } +#[ignore] #[test] fn test_display_ldr() { test_display( @@ -2244,7 +2245,7 @@ fn test_decode_chrome_entrypoint() { ); } -static instruction_bytes: [u8; 4 * 61] = [ +static INSTRUCTION_BYTES: [u8; 4 * 61] = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xd4, 0x00, 0x00, 0x80, 0x12, @@ -2311,26 +2312,27 @@ static instruction_bytes: [u8; 4 * 61] = [ #[test] fn test_decode_span() { let mut i = 0u64; - while i < instruction_bytes.len() as u64 { - let instr = ::Decoder::default().decode(instruction_bytes[(i as usize)..].iter().cloned()).unwrap(); + while i < INSTRUCTION_BYTES.len() as u64 { + let instr = ::Decoder::default().decode(INSTRUCTION_BYTES[(i as usize)..].iter().cloned()).unwrap(); println!( "Decoded {:02x}{:02x}{:02x}{:02x}: {}", //{:?}\n {}", - instruction_bytes[i as usize], - instruction_bytes[i as usize + 1], - instruction_bytes[i as usize + 2], - instruction_bytes[i as usize + 3], + INSTRUCTION_BYTES[i as usize], + INSTRUCTION_BYTES[i as usize + 1], + INSTRUCTION_BYTES[i as usize + 2], + INSTRUCTION_BYTES[i as usize + 3], // instr, instr); i += instr.len(); } } +/* use test::Bencher; #[bench] pub fn bench_60000_instrs(b: &mut Bencher) { b.iter(|| { for i in (0..1000) { - let mut iter = instruction_bytes.iter().map(|x| *x); + let mut iter = INSTRUCTION_BYTES.iter().map(|x| *x); let decoder = ::Decoder::default(); let mut result = Instruction::default(); loop { @@ -2346,3 +2348,4 @@ pub fn bench_60000_instrs(b: &mut Bencher) { } }); } +*/ diff --git a/test/test.rs b/test/test.rs index 72b7e50..fcf680a 100644 --- a/test/test.rs +++ b/test/test.rs @@ -1,6 +1,6 @@ -#![feature(test)] - -extern crate test; +// #![feature(test)] +// +// extern crate test; extern crate yaxpeax_arch; extern crate yaxpeax_arm; -- cgit v1.1