summaryrefslogtreecommitdiff
path: root/src/bin/obnam-benchmark.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/obnam-benchmark.rs')
-rw-r--r--src/bin/obnam-benchmark.rs27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/bin/obnam-benchmark.rs b/src/bin/obnam-benchmark.rs
index e6a476c..f079d75 100644
--- a/src/bin/obnam-benchmark.rs
+++ b/src/bin/obnam-benchmark.rs
@@ -10,7 +10,6 @@ use structopt::StructOpt;
fn main() {
pretty_env_logger::init_custom_env("OBNAM_BENCHMARK_LOG");
- println!("START");
info!("obnam-benchmark starts");
if let Err(err) = real_main() {
eprintln!("ERROR: {}", err);
@@ -18,7 +17,6 @@ fn main() {
exit(1);
}
info!("obnam-benchmark ends successfully");
- println!("END");
}
fn real_main() -> anyhow::Result<()> {
@@ -30,6 +28,7 @@ fn real_main() -> anyhow::Result<()> {
Command::GenerateJunk(x) => x.run()?,
Command::Run(x) => x.run()?,
Command::Spec(x) => x.run()?,
+ Command::Steps(x) => x.run()?,
}
Ok(())
@@ -51,6 +50,9 @@ enum Command {
/// Generate some junk data in a file.
GenerateJunk(GenerateJunk),
+
+ /// Show the steps for running a benchmark.
+ Steps(Steps),
}
#[derive(Debug, StructOpt)]
@@ -129,3 +131,24 @@ impl GenerateJunk {
Ok(())
}
}
+
+#[derive(Debug, StructOpt)]
+struct Steps {
+ /// Name of the specification file
+ #[structopt(parse(from_os_str))]
+ spec: PathBuf,
+}
+
+impl Steps {
+ fn run(&self) -> anyhow::Result<()> {
+ info!(
+ "showing steps to run benchmarks from {}",
+ self.spec.display()
+ );
+ let spec = Specification::from_file(&self.spec)?;
+ for step in spec.steps().iter() {
+ println!("{:?}", step);
+ }
+ Ok(())
+ }
+}