mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-09-11 14:07:02 +03:00
Expand execution order tests
This commit is contained in:
parent
aae3a4116f
commit
5df981ae7b
@ -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."
|
||||
),
|
||||
)
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user