Skip to content

Commit 0b8d705

Browse files
committed
fix: isolate rvr reveal bounds abort test
1 parent ce136d6 commit 0b8d705

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

  • extensions/riscv/tests/src

extensions/riscv/tests/src/lib.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ mod tests {
270270
#[cfg_attr(feature = "aot", ignore)]
271271
#[test]
272272
#[should_panic(expected = "Memory access out of bounds")]
273+
#[cfg(not(feature = "rvr"))]
273274
fn test_reveal_beyond_num_public_values_errors() {
274275
let mut config = test_rv64im_config();
275276
config.rv64i.system = config.rv64i.system.with_public_values_bytes(32);
@@ -288,6 +289,33 @@ mod tests {
288289
instance.execute(vec![], None).unwrap();
289290
}
290291

292+
#[test]
293+
#[should_panic(expected = "reveal out of bounds")]
294+
#[cfg(feature = "rvr")]
295+
fn test_reveal_beyond_num_public_values_errors() {
296+
if env::var(RVR_OOB_CHILD_ENV).is_ok() {
297+
let mut config = test_rv64im_config();
298+
config.rv64i.system = config.rv64i.system.with_public_values_bytes(32);
299+
let elf =
300+
build_example_program_at_path(get_programs_dir!(), "reveal", &config).unwrap();
301+
let exe = VmExe::from_elf(
302+
elf,
303+
Transpiler::<F>::default()
304+
.with_extension(Rv64ITranspilerExtension)
305+
.with_extension(Rv64MTranspilerExtension)
306+
.with_extension(Rv64IoTranspilerExtension),
307+
)
308+
.unwrap();
309+
310+
let executor = VmExecutor::new(config).unwrap();
311+
let instance = executor.instance(&exe).unwrap();
312+
instance.execute(vec![], None).unwrap();
313+
return; // unreachable: abort fired
314+
}
315+
316+
assert_child_aborts("tests::test_reveal_beyond_num_public_values_errors");
317+
}
318+
291319
#[test]
292320
fn test_reveal() -> Result<()> {
293321
let mut config = test_rv64im_config();

0 commit comments

Comments
 (0)