Expose TrapCode::Interrupt on epoch based interruption (#4105)

This commit is contained in:
Saúl Cabrera
2022-05-10 11:27:30 -04:00
committed by GitHub
parent 71fc16bbeb
commit 52524d258c
5 changed files with 16 additions and 20 deletions

View File

@@ -175,7 +175,7 @@ fn timeout_in_start() -> Result<()> {
assert_eq!(output.stdout, b"");
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("epoch deadline reached during execution"),
stderr.contains("wasm trap: interrupt"),
"bad stderr: {}",
stderr
);
@@ -196,7 +196,7 @@ fn timeout_in_invoke() -> Result<()> {
assert_eq!(output.stdout, b"");
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(
stderr.contains("epoch deadline reached during execution"),
stderr.contains("wasm trap: interrupt"),
"bad stderr: {}",
stderr
);

View File

@@ -33,7 +33,7 @@ fn loops_interruptable() -> anyhow::Result<()> {
store.engine().increment_epoch();
let trap = iloop.call(&mut store, ()).unwrap_err();
assert!(
trap.to_string().contains("epoch deadline reached"),
trap.trap_code().unwrap() == TrapCode::Interrupt,
"bad message: {}",
trap
);
@@ -50,7 +50,7 @@ fn functions_interruptable() -> anyhow::Result<()> {
store.engine().increment_epoch();
let trap = iloop.call(&mut store, ()).unwrap_err();
assert!(
trap.to_string().contains("epoch deadline reached"),
trap.trap_code().unwrap() == TrapCode::Interrupt,
"{}",
trap.to_string()
);
@@ -103,7 +103,7 @@ fn loop_interrupt_from_afar() -> anyhow::Result<()> {
thread.join().unwrap();
assert!(HITS.load(SeqCst) > NUM_HITS);
assert!(
trap.to_string().contains("epoch deadline reached"),
trap.trap_code().unwrap() == TrapCode::Interrupt,
"bad message: {}",
trap.to_string()
);
@@ -143,7 +143,7 @@ fn function_interrupt_from_afar() -> anyhow::Result<()> {
thread.join().unwrap();
assert!(HITS.load(SeqCst) > NUM_HITS);
assert!(
trap.to_string().contains("epoch deadline reached"),
trap.trap_code().unwrap() == TrapCode::Interrupt,
"bad message: {}",
trap.to_string()
);