From 08e4e2575f803920125b556fb1f4efa38e72bf19 Mon Sep 17 00:00:00 2001 From: Johnnie Birch Date: Thu, 15 Aug 2024 18:31:14 -0700 Subject: [PATCH] Add search for a default expected file and include for libsodium --- benchmarks/libsodium/default.stderr.expected | 0 benchmarks/libsodium/default.stdout.expected | 1 + crates/cli/src/benchmark.rs | 10 ++++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 benchmarks/libsodium/default.stderr.expected create mode 100644 benchmarks/libsodium/default.stdout.expected diff --git a/benchmarks/libsodium/default.stderr.expected b/benchmarks/libsodium/default.stderr.expected new file mode 100644 index 00000000..e69de29b diff --git a/benchmarks/libsodium/default.stdout.expected b/benchmarks/libsodium/default.stdout.expected new file mode 100644 index 00000000..c2270834 --- /dev/null +++ b/benchmarks/libsodium/default.stdout.expected @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/crates/cli/src/benchmark.rs b/crates/cli/src/benchmark.rs index ae496ac4..fd23a9a1 100644 --- a/crates/cli/src/benchmark.rs +++ b/crates/cli/src/benchmark.rs @@ -244,8 +244,14 @@ impl BenchmarkCommand { .with_context(|| "expected the benchmark file to have an extension")? .to_str() .with_context(|| "expected the benchmark file to have a printable name")?; - let stdout_expected = wasm_file_dir.join(format!("{}.stdout.expected", benchmark_name)); - let stderr_expected = wasm_file_dir.join(format!("{}.stderr.expected", benchmark_name)); + let mut stdout_expected = wasm_file_dir.join(format!("{}.stdout.expected", benchmark_name)); + if !stdout_expected.exists() { + stdout_expected = wasm_file_dir.join(format!("{}.stdout.expected", "default")); + } + let mut stderr_expected = wasm_file_dir.join(format!("{}.stderr.expected", benchmark_name)); + if !stderr_expected.exists() { + stderr_expected = wasm_file_dir.join(format!("{}.stderr.expected", "default")); + } compare_output_file(wasm_file, stdout, &stdout_expected)?; compare_output_file(wasm_file, stderr, &stderr_expected)?;