Skip to content

Commit

Permalink
fix: Skip full memory comparison in chaos tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xxuejie committed Jul 3, 2023
1 parent 92eda84 commit f59b0a0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_resume2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use ckb_vm::machine::{
use ckb_vm::memory::{sparse::SparseMemory, wxorx::WXorXMemory};
use ckb_vm::registers::{A0, A1, A7};
use ckb_vm::snapshot2::{DataSource, Snapshot2, Snapshot2Context};
use ckb_vm::{DefaultMachineBuilder, Error, Memory, Register, Syscalls, ISA_IMC, RISCV_MAX_MEMORY};
use ckb_vm::{DefaultMachineBuilder, Error, Register, Syscalls, ISA_IMC};
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
Expand Down Expand Up @@ -81,6 +81,7 @@ fn test_resume2_secp256k1_asm_2_interpreter_2_asm() {

assert_eq!(machine1.cycles(), machine2.cycles());
assert_eq!(machine1.full_registers(), machine2.full_registers());
#[cfg(not(feature = "enable-chaos-mode-by-default"))]
assert_eq!(machine1.full_memory(), machine2.full_memory());

machine2.set_max_cycles(100000 + 200000);
Expand All @@ -94,6 +95,7 @@ fn test_resume2_secp256k1_asm_2_interpreter_2_asm() {

assert_eq!(machine2.cycles(), machine3.cycles());
assert_eq!(machine2.full_registers(), machine3.full_registers());
#[cfg(not(feature = "enable-chaos-mode-by-default"))]
assert_eq!(machine2.full_memory(), machine3.full_memory());

machine3.set_max_cycles(100000 + 200000 + 400000);
Expand Down Expand Up @@ -126,6 +128,7 @@ fn test_resume2_load_data_asm_2_interpreter() {

assert_eq!(machine1.cycles(), machine2.cycles());
assert_eq!(machine1.full_registers(), machine2.full_registers());
#[cfg(not(feature = "enable-chaos-mode-by-default"))]
assert_eq!(machine1.full_memory(), machine2.full_memory());

machine2.set_max_cycles(except_cycles + 10);
Expand Down Expand Up @@ -159,6 +162,7 @@ fn test_resume2_load_data_interpreter_2_asm() {

assert_eq!(machine1.cycles(), machine2.cycles());
assert_eq!(machine1.full_registers(), machine2.full_registers());
#[cfg(not(feature = "enable-chaos-mode-by-default"))]
assert_eq!(machine1.full_memory(), machine2.full_memory());

machine2.set_max_cycles(except_cycles + 10);
Expand Down Expand Up @@ -515,7 +519,9 @@ impl Machine {
}
}

#[cfg(not(feature = "enable-chaos-mode-by-default"))]
fn full_memory(&mut self) -> Result<Bytes, Error> {
use ckb_vm::{Memory, RISCV_MAX_MEMORY};
use Machine::*;
match self {
Asm(inner, _) => inner
Expand Down

0 comments on commit f59b0a0

Please sign in to comment.