Add run_bench
to Cargo.toml
.
This commit is contained in:
parent
93b7e55bcf
commit
7275141203
3 changed files with 10 additions and 7 deletions
|
@ -43,3 +43,7 @@ path = "tools/dump_events.rs"
|
|||
[[bin]]
|
||||
name = "time_parse"
|
||||
path = "tools/time_parse.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "run_bench"
|
||||
path = "tools/run_bench.rs"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{fs::File, io::BufWriter, io::Write, path::Path};
|
||||
|
||||
use anyhow::Error;
|
||||
use anyhow::{Context, Error};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
fn main() {
|
||||
|
@ -51,11 +51,12 @@ fn run_bench(config: &Config) -> Result<(), Error> {
|
|||
println!("Running {input_basename} against {}", parser.name);
|
||||
// Run benchmark
|
||||
let path = Path::new(&parser.path).join("run_bench");
|
||||
let output = std::process::Command::new(path)
|
||||
let output = std::process::Command::new(&path)
|
||||
.arg(input)
|
||||
.arg(&iterations)
|
||||
.arg("--output-yaml")
|
||||
.output()?;
|
||||
.output()
|
||||
.with_context(|| format!("While running {path:?} against {input}"))?;
|
||||
// Check exit status.
|
||||
if output.status.code().unwrap_or(1) == 0 {
|
||||
let s = String::from_utf8_lossy(&output.stdout);
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#![allow(clippy::cast_possible_truncation, clippy::cast_precision_loss)]
|
||||
|
||||
use std::{env, fs::File, io::prelude::*};
|
||||
use saphyr_parser::{
|
||||
parser::{MarkedEventReceiver, Parser},
|
||||
scanner::Marker,
|
||||
Event,
|
||||
Event, Marker, {MarkedEventReceiver, Parser},
|
||||
};
|
||||
use std::{env, fs::File, io::prelude::*};
|
||||
|
||||
/// A sink which discards any event sent.
|
||||
struct NullSink {}
|
||||
|
|
Loading…
Reference in a new issue