Resume on each PendingEvent by pushing the next interactive_events entry.
(vm: &mut VM, interactive: &[String])
| 45 | |
| 46 | // Resume on each PendingEvent by pushing the next interactive_events entry. |
| 47 | fn drive(vm: &mut VM, interactive: &[String]) -> Result<(), VmErr> { |
| 48 | let mut idx = 0; |
| 49 | loop { |
| 50 | match vm.run() { |
| 51 | Ok(_) => return Ok(()), |
| 52 | Err(VmErr::HostYield(SchedulerStatus::PendingEvent)) => { |
| 53 | if idx >= interactive.len() { return Ok(()); } |
| 54 | vm.push_event(&interactive[idx]).expect("push_event"); |
| 55 | idx += 1; |
| 56 | } |
| 57 | Err(e) => return Err(e), |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | /* Runs every vm.json case under `Limits::sandbox()` rather than `none()`: the budget / heap / call-depth guards are off under `none` (`sandbox_off` short-circuits them), so only the bounded profile exercises the charge_step / charge_steps / back-edge-budget paths and lets cases assert that runaway allocation, recursion, and materialisation surface as `MemoryError` / `RecursionError` instead of hanging. Every case must therefore stay within the sandbox budget. */ |
| 63 | #[test] |
no test coverage detected