From 99e0fb0e38e34303df63a1a1fe5586245dbd4780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Mon, 10 Jun 2024 11:20:45 +0100 Subject: [PATCH] RISC-V: Get timings out of run command --- src/riscv/sandbox/src/commands/run.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/riscv/sandbox/src/commands/run.rs b/src/riscv/sandbox/src/commands/run.rs index a81fcc976b91..327409d55447 100644 --- a/src/riscv/sandbox/src/commands/run.rs +++ b/src/riscv/sandbox/src/commands/run.rs @@ -3,13 +3,13 @@ // // SPDX-License-Identifier: MIT -use crate::{cli::RunOptions, posix_exit_mode}; +use crate::{cli::RunOptions, console::Console, posix_exit_mode}; use octez_riscv::{ exec_env::pvm::PvmSbiConfig, machine_state::bus::main_memory::M1G, stepper::{pvm::PvmStepper, test::TestStepper, StepResult, Stepper, StepperStatus}, }; -use std::{error::Error, fs}; +use std::{error::Error, fs, io::Write}; use tezos_smart_rollup::utils::inbox::InboxBuilder; use tezos_smart_rollup_encoding::smart_rollup::SmartRollupAddress; @@ -48,7 +48,16 @@ fn run_pvm(program: &[u8], initrd: Option<&[u8]>, opts: &RunOptions) -> Result<( let rollup_address = SmartRollupAddress::from_b58check(opts.common.inbox.address.as_str())?; - let config = PvmSbiConfig::default(); + let mut console = if opts.common.timings { + Console::with_timings() + } else { + Console::new() + }; + + let config = PvmSbiConfig::new(|c| { + let _written = console.write(&[c]).unwrap(); + }); + let mut backend = PvmStepper::<'_, '_, M1G>::create_backend(); let stepper = PvmStepper::new( &mut backend, -- GitLab