Skip to content

Commit e03ba73

Browse files
committed
rs: update tests after upstream bugs are fixed
1 parent 7efae1a commit e03ba73

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
@@ -607,9 +607,13 @@ fn test_instruction_details() {
607607
&[X86_REG_RIP, X86_REG_RSP],
608608
&[X86_REG_RSP, X86_REG_RIP],
609609
),
610-
// Upstream bug: ret should read rsp to compute the new rsp
611-
// https://github.com/capstone-engine/capstone/issues/2714
612-
("ret", b"\xc3", &[RET], &[], &[X86_REG_RIP, X86_REG_RSP]),
610+
(
611+
"ret",
612+
b"\xc3",
613+
&[RET],
614+
&[X86_REG_RSP],
615+
&[X86_REG_RIP, X86_REG_RSP],
616+
),
613617
("syscall", b"\x0f\x05", &[INT], &[], &[]),
614618
("iretd", b"\xcf", &[IRET], &[], &[]),
615619
(
@@ -798,9 +802,7 @@ fn test_syntax() {
798802
"retq",
799803
b"\xc3",
800804
&[RET],
801-
// Upstream bug: ret should read rsp
802-
// https://github.com/capstone-engine/capstone/issues/2714
803-
&[],
805+
&[X86_REG_RSP],
804806
&[X86_REG_RSP, X86_REG_RIP],
805807
),
806808
("syscall", "syscall", b"\x0f\x05", &[INT], &[], &[]),
@@ -1131,7 +1133,7 @@ fn test_arch_arm_detail() {
11311133
use crate::arch::arm::ArmOperandType::*;
11321134
use crate::arch::arm::*;
11331135
use capstone_sys::arm_op_mem;
1134-
use capstone_sys::arm_spsr_cspr_bits;
1136+
use capstone_sys::arm_spsr_cpsr_bits;
11351137

11361138
let r0_op_read = ArmOperand {
11371139
op_type: Reg(RegId(ArmReg::ARM_REG_R0 as RegIdInt)),
@@ -1272,8 +1274,8 @@ fn test_arch_arm_detail() {
12721274
&[
12731275
ArmOperand {
12741276
op_type: Cpsr(
1275-
arm_spsr_cspr_bits::ARM_FIELD_CPSR_F
1276-
| arm_spsr_cspr_bits::ARM_FIELD_CPSR_C,
1277+
arm_spsr_cpsr_bits::ARM_FIELD_CPSR_F
1278+
| arm_spsr_cpsr_bits::ARM_FIELD_CPSR_C,
12771279
),
12781280
access: Some(RegAccessType::WriteOnly),
12791281
..Default::default()
@@ -1699,9 +1701,14 @@ fn test_arch_aarch64_detail() {
16991701
// smstart
17001702
DII::new("smstart", b"\x7f\x47\x03\xd5", &[]),
17011703
// smstart sm
1702-
// Upstream bug: no way to figure out sm?
1703-
// https://github.com/capstone-engine/capstone/issues/2715
1704-
DII::new("smstart", b"\x7f\x43\x03\xd5", &[]),
1704+
DII::new(
1705+
"smstart",
1706+
b"\x7f\x43\x03\xd5",
1707+
&[AArch64Operand {
1708+
op_type: Svcr(AArch64Svcr::AARCH64_SVCR_SVCRSM),
1709+
..Default::default()
1710+
}],
1711+
),
17051712
// ldr za[w12, 4], [x0, #4, mul vl]
17061713
DII::new(
17071714
"ldr",
@@ -2253,9 +2260,7 @@ fn test_arch_loongarch_detail() {
22532260
op_type: loongarch::LoongArchOperandType::Reg(RegId(
22542261
LOONGARCH_REG_S1 as RegIdInt,
22552262
)),
2256-
// Upstream bug: should be read only
2257-
// https://github.com/capstone-engine/capstone/issues/2700
2258-
access: Some(RegAccessType::WriteOnly),
2263+
access: Some(RegAccessType::ReadOnly),
22592264
},
22602265
LoongArchOperand {
22612266
op_type: loongarch::LoongArchOperandType::Mem(LoongArchOpMem(
@@ -4730,12 +4735,10 @@ fn test_regs_access_arm() {
47304735
.unwrap(),
47314736
b"\xf0\xbd",
47324737
CsResult::Ok(&[as_reg_access(
4733-
// Upstream bug: register written are reported as read
4734-
// https://github.com/capstone-engine/capstone/issues/2713
4738+
&[ARM_REG_SP],
47354739
&[
47364740
ARM_REG_SP, ARM_REG_R4, ARM_REG_R5, ARM_REG_R6, ARM_REG_R7, ARM_REG_PC,
47374741
],
4738-
&[ARM_REG_SP],
47394742
)]),
47404743
);
47414744
}

0 commit comments

Comments
 (0)