diff --git a/src/app.rs b/src/app.rs index 8d8fe7c..b1f1ef2 100644 --- a/src/app.rs +++ b/src/app.rs @@ -76,7 +76,7 @@ fn build_app() -> App<'static> { .help( "Execute CMD before each set of timing runs. This is useful for \ compiling your software with the provided parameters, or to do any \ - other work that should happen once before a series of benchmark runs,\ + other work that should happen once before a series of benchmark runs, \ not every time as would happen with the --prepare option." ), ) diff --git a/tests/execution_order_tests.rs b/tests/execution_order_tests.rs index 6d4dce0..fbbfe4e 100644 --- a/tests/execution_order_tests.rs +++ b/tests/execution_order_tests.rs @@ -160,6 +160,33 @@ fn prepare_commands_are_executed_before_each_timing_run() { .run(); } +#[test] +fn prepare_commands_are_executed_before_each_warmup() { + ExecutionOrderTest::new() + .arg("--warmup=2") + .arg("--runs=1") + .prepare("prepare") + .command("command 1") + .command("command 2") + // warmup 1 + .expect_output("prepare") + .expect_output("command 1") + .expect_output("prepare") + .expect_output("command 1") + // benchmark 1 + .expect_output("prepare") + .expect_output("command 1") + // warmup 2 + .expect_output("prepare") + .expect_output("command 2") + .expect_output("prepare") + .expect_output("command 2") + // benchmark 2 + .expect_output("prepare") + .expect_output("command 2") + .run(); +} + #[test] fn cleanup_commands_are_executed_once_after_each_benchmark() { ExecutionOrderTest::new() @@ -179,17 +206,31 @@ fn cleanup_commands_are_executed_once_after_each_benchmark() { #[test] fn setup_prepare_cleanup_combined() { ExecutionOrderTest::new() + .arg("--warmup=1") .arg("--runs=2") - .setup("make") - .prepare("make testclean") - .command("make test") - .cleanup("make clean") - .expect_output("make") - .expect_output("make testclean") - .expect_output("make test") - .expect_output("make testclean") - .expect_output("make test") - .expect_output("make clean") + .setup("setup") + .prepare("prepare") + .command("command1") + .command("command2") + .cleanup("cleanup") + // 1 + .expect_output("setup") + .expect_output("prepare") + .expect_output("command1") + .expect_output("prepare") + .expect_output("command1") + .expect_output("prepare") + .expect_output("command1") + .expect_output("cleanup") + // 2 + .expect_output("setup") + .expect_output("prepare") + .expect_output("command2") + .expect_output("prepare") + .expect_output("command2") + .expect_output("prepare") + .expect_output("command2") + .expect_output("cleanup") .run(); }