Expand execution order tests
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by David Peter · parent aae3a41 · Browse files · 2 files·+52 added−11 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+52 added−11 removed
- tests:+51 added−10 removed
- other:+1 added−1 removed
Provenance
- Commit
5df981a- Tree
173e9c9- Author
David Peter <mail@david-peter.de>- Committer
David Peter <mail@david-peter.de>- Parent
aae3a41
2 files changed+52 added−11 removed
modified:src/app.rs+1 added-1 removed
74 unmodified lines75 .value_name("CMD")76 .help(77 "Execute CMD before each set of timing runs. This is useful for \78 compiling your software with the provided parameters, or to do any \79- other work that should happen once before a series of benchmark runs,\79+ other work that should happen once before a series of benchmark runs, \80 not every time as would happen with the --prepare option."81 ),82 )83 .arg(174 unmodified linesmodified:tests/execution_order_tests.rs+51 added-10 removed
159 unmodified lines160 .run();161 }162 163 #[test]164+fn prepare_commands_are_executed_before_each_warmup() {165+ ExecutionOrderTest::new()166+ .arg("--warmup=2")167+ .arg("--runs=1")168+ .prepare("prepare")169+ .command("command 1")170+ .command("command 2")171+ // warmup 1172+ .expect_output("prepare")173+ .expect_output("command 1")174+ .expect_output("prepare")175+ .expect_output("command 1")176+ // benchmark 1177+ .expect_output("prepare")178+ .expect_output("command 1")179+ // warmup 2180+ .expect_output("prepare")181+ .expect_output("command 2")182+ .expect_output("prepare")183+ .expect_output("command 2")184+ // benchmark 2185+ .expect_output("prepare")186+ .expect_output("command 2")187+ .run();188+}189+190+#[test]191 fn cleanup_commands_are_executed_once_after_each_benchmark() {192 ExecutionOrderTest::new()193 .arg("--runs=2")194 .cleanup("cleanup")10 unmodified lines205 206 #[test]207 fn setup_prepare_cleanup_combined() {208 ExecutionOrderTest::new()209+ .arg("--warmup=1")210 .arg("--runs=2")183- .setup("make")184- .prepare("make testclean")185- .command("make test")186- .cleanup("make clean")187- .expect_output("make")188- .expect_output("make testclean")189- .expect_output("make test")190- .expect_output("make testclean")191- .expect_output("make test")192- .expect_output("make clean")211+ .setup("setup")212+ .prepare("prepare")213+ .command("command1")214+ .command("command2")215+ .cleanup("cleanup")216+ // 1217+ .expect_output("setup")218+ .expect_output("prepare")219+ .expect_output("command1")220+ .expect_output("prepare")221+ .expect_output("command1")222+ .expect_output("prepare")223+ .expect_output("command1")224+ .expect_output("cleanup")225+ // 2226+ .expect_output("setup")227+ .expect_output("prepare")228+ .expect_output("command2")229+ .expect_output("prepare")230+ .expect_output("command2")231+ .expect_output("prepare")232+ .expect_output("command2")233+ .expect_output("cleanup")234 .run();235 }236 237 #[test]41 unmodified lines