flag_exclude: Vec<String>,
#[serde(rename = "flag_Z")]
flag_z: Vec<String>,
+ #[serde(rename = "arg_BENCHNAME")]
+ arg_benchname: Option<String>,
}
pub const USAGE: &'static str = "
Execute all benchmarks of a local package
Usage:
- cargo bench [options] [--] [<args>...]
+ cargo bench [options] [BENCHNAME] [--] [<args>...]
Options:
+ BENCHNAME If specified, only run benches containing this string in their names
-h, --help Print this message
--lib Benchmark only this package's library
--bin NAME ... Benchmark only the specified binary
Compilation can be customized with the `bench` profile in the manifest.
";
-pub fn execute(options: Options, config: &mut Config) -> CliResult {
+pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
debug!("executing; cmd=cargo-bench; args={:?}",
env::args().collect::<Vec<_>>());
},
};
+ if let Some(test) = options.arg_benchname.take() {
+ options.arg_args.insert(0, test);
+ }
+
let err = ops::run_benches(&ws, &ops, &options.arg_args)?;
match err {
None => Ok(()),
flag_exclude: Vec<String>,
#[serde(rename = "flag_Z")]
flag_z: Vec<String>,
+ #[serde(rename = "arg_TESTNAME")]
+ arg_testname: Option<String>,
}
pub const USAGE: &'static str = "
Execute all unit and integration tests of a local package
Usage:
- cargo test [options] [--] [<args>...]
+ cargo test [options] [TESTNAME] [--] [<args>...]
Options:
+ TESTNAME If specified, only run tests containing this string in their names
-h, --help Print this message
--lib Test only this package's library
--doc Test only this library's documentation
cargo test -- --help
";
-pub fn execute(options: Options, config: &mut Config) -> CliResult {
+pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
debug!("executing; cmd=cargo-test; args={:?}",
env::args().collect::<Vec<_>>());
},
};
+ // TESTNAME is actually an argument of the test binary, but it's
+ // important so we explicitly mention it and reconfigure
+ if let Some(test) = options.arg_testname.take() {
+ options.arg_args.insert(0, test);
+ }
+
let err = ops::run_tests(&ws, &ops, &options.arg_args)?;
match err {
None => Ok(()),