Skip to content

Commit 0a118aa

Browse files
committed
rs: update tests after upstream bugs are fixed
1 parent 8db0002 commit 0a118aa

File tree

2 files changed

+22
-21
lines changed

2 files changed

+22
-21
lines changed

capstone-rs/src/arch/arm.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ pub use capstone_sys::arm_insn_group as ArmInsnGroup;
2121
pub use capstone_sys::arm_mem_bo_opt as ArmMemBarrier;
2222
pub use capstone_sys::arm_reg as ArmReg;
2323
pub use capstone_sys::arm_setend_type as ArmSetendType;
24-
pub use capstone_sys::arm_spsr_cspr_bits;
2524
pub use capstone_sys::arm_sysreg as ArmSysreg;
2625
pub use capstone_sys::arm_vectordata_type as ArmVectorData;
27-
// Upstream typo: cspr -> cpsr
28-
pub use capstone_sys::arm_spsr_cspr_bits as ArmSpsrCpsrBits;
26+
pub use capstone_sys::arm_spsr_cpsr_bits as ArmSpsrCpsrBits;
2927
pub use capstone_sys::ARMCC_CondCodes as ArmCC;
3028

3129
/// Contains ARM-specific details for an instruction

capstone-rs/src/test.rs

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -514,9 +514,13 @@ fn test_instruction_details() {
514514
&[X86_REG_RIP, X86_REG_RSP],
515515
&[X86_REG_RSP, X86_REG_RIP],
516516
),
517-
// Upstream bug: ret should read rsp to compute the new rsp
518-
// https://github.com/capstone-engine/capstone/issues/2714
519-
("ret", b"\xc3", &[RET], &[], &[X86_REG_RIP, X86_REG_RSP]),
517+
(
518+
"ret",
519+
b"\xc3",
520+
&[RET],
521+
&[X86_REG_RSP],
522+
&[X86_REG_RIP, X86_REG_RSP],
523+
),
520524
("syscall", b"\x0f\x05", &[INT], &[], &[]),
521525
("iretd", b"\xcf", &[IRET], &[], &[]),
522526
(
@@ -705,9 +709,7 @@ fn test_syntax() {
705709
"retq",
706710
b"\xc3",
707711
&[RET],
708-
// Upstream bug: ret should read rsp
709-
// https://github.com/capstone-engine/capstone/issues/2714
710-
&[],
712+
&[X86_REG_RSP],
711713
&[X86_REG_RSP, X86_REG_RIP],
712714
),
713715
("syscall", "syscall", b"\x0f\x05", &[INT], &[], &[]),
@@ -1038,7 +1040,7 @@ fn test_arch_arm_detail() {
10381040
use crate::arch::arm::ArmOperandType::*;
10391041
use crate::arch::arm::*;
10401042
use capstone_sys::arm_op_mem;
1041-
use capstone_sys::arm_spsr_cspr_bits;
1043+
use capstone_sys::arm_spsr_cpsr_bits;
10421044

10431045
let r0_op_read = ArmOperand {
10441046
op_type: Reg(RegId(ArmReg::ARM_REG_R0 as RegIdInt)),
@@ -1179,8 +1181,8 @@ fn test_arch_arm_detail() {
11791181
&[
11801182
ArmOperand {
11811183
op_type: Cpsr(
1182-
arm_spsr_cspr_bits::ARM_FIELD_CPSR_F
1183-
| arm_spsr_cspr_bits::ARM_FIELD_CPSR_C,
1184+
arm_spsr_cpsr_bits::ARM_FIELD_CPSR_F
1185+
| arm_spsr_cpsr_bits::ARM_FIELD_CPSR_C,
11841186
),
11851187
access: Some(RegAccessType::WriteOnly),
11861188
..Default::default()
@@ -1606,9 +1608,14 @@ fn test_arch_aarch64_detail() {
16061608
// smstart
16071609
DII::new("smstart", b"\x7f\x47\x03\xd5", &[]),
16081610
// smstart sm
1609-
// Upstream bug: no way to figure out sm?
1610-
// https://github.com/capstone-engine/capstone/issues/2715
1611-
DII::new("smstart", b"\x7f\x43\x03\xd5", &[]),
1611+
DII::new(
1612+
"smstart",
1613+
b"\x7f\x43\x03\xd5",
1614+
&[AArch64Operand {
1615+
op_type: Svcr(AArch64Svcr::AARCH64_SVCR_SVCRSM),
1616+
..Default::default()
1617+
}],
1618+
),
16121619
// ldr za[w12, 4], [x0, #4, mul vl]
16131620
DII::new(
16141621
"ldr",
@@ -2160,9 +2167,7 @@ fn test_arch_loongarch_detail() {
21602167
op_type: loongarch::LoongArchOperandType::Reg(RegId(
21612168
LOONGARCH_REG_S1 as RegIdInt,
21622169
)),
2163-
// Upstream bug: should be read only
2164-
// https://github.com/capstone-engine/capstone/issues/2700
2165-
access: Some(RegAccessType::WriteOnly),
2170+
access: Some(RegAccessType::ReadOnly),
21662171
},
21672172
LoongArchOperand {
21682173
op_type: loongarch::LoongArchOperandType::Mem(LoongArchOpMem(
@@ -4637,12 +4642,10 @@ fn test_regs_access_arm() {
46374642
.unwrap(),
46384643
b"\xf0\xbd",
46394644
CsResult::Ok(&[as_reg_access(
4640-
// Upstream bug: register written are reported as read
4641-
// https://github.com/capstone-engine/capstone/issues/2713
4645+
&[ARM_REG_SP],
46424646
&[
46434647
ARM_REG_SP, ARM_REG_R4, ARM_REG_R5, ARM_REG_R6, ARM_REG_R7, ARM_REG_PC,
46444648
],
4645-
&[ARM_REG_SP],
46464649
)]),
46474650
);
46484651
}

0 commit comments

Comments
 (0)