Skip to content

Commit 60ab850

Browse files
authored
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.
1 parent 6546da2 commit 60ab850

File tree

1 file changed

+21
-45
lines changed

1 file changed

+21
-45
lines changed

pulley/tests/all/disas.rs

Lines changed: 21 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ fn assert_disas_with_disassembler(dis: &mut disas::Disassembler<'_>, expected: &
2727
#[track_caller]
2828
fn assert_disas(ops: &[Op], expected: &str) {
2929
let bytecode = encoded(ops);
30-
assert_disas_with_disassembler(&mut disas::Disassembler::new(&bytecode), expected);
30+
assert_disas_with_disassembler(
31+
&mut disas::Disassembler::new(&bytecode).hexdump(false),
32+
expected,
33+
);
3134
}
3235

3336
#[test]
@@ -49,10 +52,10 @@ fn simple() {
4952
Op::Ret(Ret {}),
5053
],
5154
r#"
52-
0: 35 push_frame
53-
1: 18 00 04 xadd32 x0, x0, x1
54-
4: 36 pop_frame
55-
5: 00 ret
55+
0: push_frame
56+
1: xadd32 x0, x0, x1
57+
4: pop_frame
58+
5: ret
5659
"#,
5760
);
5861
}
@@ -82,12 +85,12 @@ fn push_pop_many() {
8285
Op::Ret(Ret {}),
8386
],
8487
r#"
85-
0: 35 push_frame
86-
1: 38 1f 00 00 00 xpush32_many x0, x1, x2, x3, x4
87-
6: 18 00 04 xadd32 x0, x0, x1
88-
9: 3c 1f 00 00 00 xpop32_many x0, x1, x2, x3, x4
89-
e: 36 pop_frame
90-
f: 00 ret
88+
0: push_frame
89+
1: xpush32_many x0, x1, x2, x3, x4
90+
6: xadd32 x0, x0, x1
91+
9: xpop32_many x0, x1, x2, x3, x4
92+
e: pop_frame
93+
f: ret
9194
"#,
9295
);
9396
}
@@ -111,41 +114,14 @@ fn no_offsets() {
111114
]);
112115

113116
assert_disas_with_disassembler(
114-
disas::Disassembler::new(&bytecode).offsets(false),
115-
r#"
116-
35 push_frame
117-
18 00 04 xadd32 x0, x0, x1
118-
36 pop_frame
119-
00 ret
120-
"#,
121-
);
122-
}
123-
124-
#[test]
125-
fn no_hexdump() {
126-
let bytecode = encoded(&[
127-
// Prologue.
128-
Op::PushFrame(PushFrame {}),
129-
// Function body.
130-
Op::Xadd32(Xadd32 {
131-
operands: BinaryOperands {
132-
dst: XReg::x0,
133-
src1: XReg::x0,
134-
src2: XReg::x1,
135-
},
136-
}),
137-
// Epilogue.
138-
Op::PopFrame(PopFrame {}),
139-
Op::Ret(Ret {}),
140-
]);
141-
142-
assert_disas_with_disassembler(
143-
disas::Disassembler::new(&bytecode).hexdump(false),
117+
disas::Disassembler::new(&bytecode)
118+
.offsets(false)
119+
.hexdump(false),
144120
r#"
145-
0: push_frame
146-
1: xadd32 x0, x0, x1
147-
4: pop_frame
148-
5: ret
121+
push_frame
122+
xadd32 x0, x0, x1
123+
pop_frame
124+
ret
149125
"#,
150126
);
151127
}

0 commit comments

Comments
 (0)