From 60ab85008e161f8315dff047c1c5b81ad2acfbc0 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 22 Nov 2024 14:15:35 -0700 Subject: [PATCH] pulley: Don't test hexdumps by default (#9662) These are brittle tests as we add/remove opcodes so minimize the number of tests that are doing this. This is already exposed through other testing like in Cranelift or disas testing, so don't have any manually-updated tests with hex dumps. --- pulley/tests/all/disas.rs | 66 +++++++++++++-------------------------- 1 file changed, 21 insertions(+), 45 deletions(-) diff --git a/pulley/tests/all/disas.rs b/pulley/tests/all/disas.rs index d1466b1e134c..68b3ff06e281 100644 --- a/pulley/tests/all/disas.rs +++ b/pulley/tests/all/disas.rs @@ -27,7 +27,10 @@ fn assert_disas_with_disassembler(dis: &mut disas::Disassembler<'_>, expected: & #[track_caller] fn assert_disas(ops: &[Op], expected: &str) { let bytecode = encoded(ops); - assert_disas_with_disassembler(&mut disas::Disassembler::new(&bytecode), expected); + assert_disas_with_disassembler( + &mut disas::Disassembler::new(&bytecode).hexdump(false), + expected, + ); } #[test] @@ -49,10 +52,10 @@ fn simple() { Op::Ret(Ret {}), ], r#" - 0: 35 push_frame - 1: 18 00 04 xadd32 x0, x0, x1 - 4: 36 pop_frame - 5: 00 ret + 0: push_frame + 1: xadd32 x0, x0, x1 + 4: pop_frame + 5: ret "#, ); } @@ -82,12 +85,12 @@ fn push_pop_many() { Op::Ret(Ret {}), ], r#" - 0: 35 push_frame - 1: 38 1f 00 00 00 xpush32_many x0, x1, x2, x3, x4 - 6: 18 00 04 xadd32 x0, x0, x1 - 9: 3c 1f 00 00 00 xpop32_many x0, x1, x2, x3, x4 - e: 36 pop_frame - f: 00 ret + 0: push_frame + 1: xpush32_many x0, x1, x2, x3, x4 + 6: xadd32 x0, x0, x1 + 9: xpop32_many x0, x1, x2, x3, x4 + e: pop_frame + f: ret "#, ); } @@ -111,41 +114,14 @@ fn no_offsets() { ]); assert_disas_with_disassembler( - disas::Disassembler::new(&bytecode).offsets(false), - r#" -35 push_frame -18 00 04 xadd32 x0, x0, x1 -36 pop_frame -00 ret - "#, - ); -} - -#[test] -fn no_hexdump() { - let bytecode = encoded(&[ - // Prologue. - Op::PushFrame(PushFrame {}), - // Function body. - Op::Xadd32(Xadd32 { - operands: BinaryOperands { - dst: XReg::x0, - src1: XReg::x0, - src2: XReg::x1, - }, - }), - // Epilogue. - Op::PopFrame(PopFrame {}), - Op::Ret(Ret {}), - ]); - - assert_disas_with_disassembler( - disas::Disassembler::new(&bytecode).hexdump(false), + disas::Disassembler::new(&bytecode) + .offsets(false) + .hexdump(false), r#" - 0: push_frame - 1: xadd32 x0, x0, x1 - 4: pop_frame - 5: ret +push_frame +xadd32 x0, x0, x1 +pop_frame +ret "#, ); }