Skip to content
Myr

raise error if preparation_command length is not equal to command or 1

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Saurav Sharma · committed by David Peter · parent 0c0713d · Browse files · 2 files+12 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Saurav Sharma <appdroiddeveloper@gmail.com>

Diff stats

2 files+12 added−5 removed

  • other:+12 added−5 removed

2 files+12 added−5 removed

modified:src/hyperfine/benchmark.rs+2 added-5 removed
234 unmodified lines
235236 // Run init command237 let mut prepare_cmd = None;238 if let Some(values) = &options.preparation_command {239 if num >= values.len() {240 prepare_cmd = Some(new_command_from_get_parameter(241 cmd,242 &values[values.len() - 1],243 ));239 if values.len() == 1 {240 prepare_cmd = Some(new_command_from_get_parameter(cmd, &values[0]));241 } else {242 prepare_cmd = Some(new_command_from_get_parameter(cmd, &values[num]));243 }244 };
174 unmodified lines
modified:src/main.rs+10 added
31 unmodified lines
32 mean_shell_spawning_time(&options.shell, options.output_style, options.show_output)?;3334 let mut timing_results = vec![];3536 // Check if preparation command is equal to command length or should be mentioned only once37 if let Some(preparation_command) = &options.preparation_command {38 if commands.len() != preparation_command.len() && preparation_command.len() > 1 {39 error(40 "--prepare option should be provided only 1 time or N times equal to number of \41 commands to benchmark",42 );43 }44 }4546 // Run the benchmarks47 for (num, cmd) in commands.iter().enumerate() {48 timing_results.push(run_benchmark(num, cmd, shell_spawning_time, options)?);49 }
162 unmodified lines