diff --git a/bench/src/build_benchmark_jsons.rs b/bench/src/build_benchmark_jsons.rs index 1a8423aff..26fb46708 100644 --- a/bench/src/build_benchmark_jsons.rs +++ b/bench/src/build_benchmark_jsons.rs @@ -10,6 +10,8 @@ html_logo_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png", html_favicon_url = "https://github.com/tauri-apps/tauri/raw/dev/.github/icon.png" )] +// file is used by multiple binaries +#![allow(dead_code)] use std::{fs::File, io::BufReader}; mod utils; diff --git a/bench/src/run_benchmark.rs b/bench/src/run_benchmark.rs index 76a73b0a3..e3ea2179a 100644 --- a/bench/src/run_benchmark.rs +++ b/bench/src/run_benchmark.rs @@ -106,10 +106,9 @@ fn run_max_mem_benchmark() -> Result> { let proc_result = proc.wait_with_output()?; println!("{proc_result:?}"); - results.insert( - name.to_string(), - utils::parse_max_mem(benchmark_file).unwrap(), - ); + if let Some(max_mem) = utils::parse_max_mem(benchmark_file)? { + results.insert(name.to_string(), max_mem); + } } Ok(results) @@ -229,7 +228,7 @@ fn run_exec_time(target_dir: &Path) -> Result>()); + utils::run(&command.iter().map(|s| s.as_ref()).collect::>())?; let mut results = HashMap::>::new(); let hyperfine_results = utils::read_json(benchmark_file)?; @@ -264,7 +263,7 @@ fn main() -> Result<()> { utils::download_file( "https://github.com/lemarier/tauri-test/releases/download/v2.0.0/json_3mb.json", json_3mb, - ); + )?; } println!("Starting tauri benchmark"); @@ -278,7 +277,7 @@ fn main() -> Result<()> { let now = time::OffsetDateTime::now_utc(); let mut new_data = utils::BenchResult { created_at: now.format(&format).unwrap(), - sha1: utils::run_collect(&["git", "rev-parse", "HEAD"]) + sha1: utils::run_collect(&["git", "rev-parse", "HEAD"])? .0 .trim() .to_string(), diff --git a/bench/src/utils.rs b/bench/src/utils.rs index f0a4b83da..48d0ba7eb 100644 --- a/bench/src/utils.rs +++ b/bench/src/utils.rs @@ -96,9 +96,8 @@ pub fn home_path() -> PathBuf { } /// Get the root path of the Tauri repository. -/// Returns `None` if the parent path cannot be determined. -pub fn tauri_root_path() -> Option { - bench_root_path().parent().map(|p| p.to_path_buf()) +pub fn tauri_root_path() -> PathBuf { + bench_root_path().parent().map(|p| p.to_path_buf()).unwrap() } /// Run a command and collect its stdout and stderr as strings.