Skip to content

Commit

Permalink
[difftest] unsuccessful simulation will panic in final block
Browse files Browse the repository at this point in the history
can be suppressed by setting 'T1_SUPPRESS_PANIC_IN_FINAL=1'
  • Loading branch information
FanShupei committed Sep 5, 2024
1 parent ea2c089 commit 6d2b0d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions difftest/dpi_common/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
//! utility functions
pub fn write_perf_json(cycle: u64, success: bool) {
// unsuccessful simulation will panic by default.
// However, it could be suppressed by setting env T1_SUPPRESS_PANIC_IN_FINAL=1
if !success && !suppress_panic_in_final() {
panic!("simulation ends unsuccessfully [T={cycle}]");
}

let mut content = String::new();
content += "{\n";
content += &format!(" \"total_cycles\": {cycle},\n");
Expand All @@ -14,3 +20,7 @@ pub fn write_perf_json(cycle: u64, success: bool) {
}
}
}

fn suppress_panic_in_final() -> bool {
std::env::var("T1_SUPPRESS_PANIC_IN_FINAL").as_deref() == Ok("1")
}

0 comments on commit 6d2b0d4

Please sign in to comment.