mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
New Scheduler struct
This commit is contained in:
1 parent
39984a3896
commit
72d27729fa
6 files changed
+118
-84
No files matched your search
@@ -1,12 +1,16 @@
|
||||
use std::process::Command;
|
||||
use std::{cmp, fmt};
|
||||
|
||||
use anyhow::ensure;
|
||||
use atty::Stream;
|
||||
use clap::ArgMatches;
|
||||
|
||||
use crate::command::Commands;
|
||||
use crate::error::OptionsError;
|
||||
use crate::util::units::{Second, Unit};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub const DEFAULT_SHELL: &str = "sh";
|
||||
|
||||
@@ -256,6 +260,18 @@ impl Options {
|
||||
|
||||
Ok(options)
|
||||
}
|
||||
|
||||
pub fn validate_against_command_list(&self, commands: &Commands) -> Result<()> {
|
||||
if let Some(preparation_command) = &self.preparation_command {
|
||||
ensure!(
|
||||
preparation_command.len() <= 1 || commands.len() == preparation_command.len(),
|
||||
"The '--prepare' option has to be provided just once or N times, where N is the \
|
||||
number of benchmark commands."
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user