Add rustc-args option to test runner
This commit is contained in:
parent
44afd76788
commit
db41f1e1cf
2 changed files with 18 additions and 0 deletions
|
@ -750,6 +750,7 @@ impl Step for Compiletest {
|
||||||
flags.push("-g".to_string());
|
flags.push("-g".to_string());
|
||||||
}
|
}
|
||||||
flags.push("-Zmiri -Zunstable-options".to_string());
|
flags.push("-Zmiri -Zunstable-options".to_string());
|
||||||
|
flags.push(build.config.cmd.rustc_args().join(" "));
|
||||||
|
|
||||||
if let Some(linker) = build.linker(target) {
|
if let Some(linker) = build.linker(target) {
|
||||||
cmd.arg("--linker").arg(linker);
|
cmd.arg("--linker").arg(linker);
|
||||||
|
|
|
@ -54,6 +54,7 @@ pub enum Subcommand {
|
||||||
Test {
|
Test {
|
||||||
paths: Vec<PathBuf>,
|
paths: Vec<PathBuf>,
|
||||||
test_args: Vec<String>,
|
test_args: Vec<String>,
|
||||||
|
rustc_args: Vec<String>,
|
||||||
fail_fast: bool,
|
fail_fast: bool,
|
||||||
},
|
},
|
||||||
Bench {
|
Bench {
|
||||||
|
@ -150,6 +151,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`");
|
||||||
"test" => {
|
"test" => {
|
||||||
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
|
opts.optflag("", "no-fail-fast", "Run all tests regardless of failure");
|
||||||
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
opts.optmulti("", "test-args", "extra arguments", "ARGS");
|
||||||
|
opts.optmulti(
|
||||||
|
"",
|
||||||
|
"rustc-args",
|
||||||
|
"extra options to pass the compiler when running tests",
|
||||||
|
"ARGS",
|
||||||
|
);
|
||||||
},
|
},
|
||||||
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
"bench" => { opts.optmulti("", "test-args", "extra arguments", "ARGS"); },
|
||||||
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
|
"clean" => { opts.optflag("", "all", "clean all build artifacts"); },
|
||||||
|
@ -283,6 +290,7 @@ Arguments:
|
||||||
Subcommand::Test {
|
Subcommand::Test {
|
||||||
paths,
|
paths,
|
||||||
test_args: matches.opt_strs("test-args"),
|
test_args: matches.opt_strs("test-args"),
|
||||||
|
rustc_args: matches.opt_strs("rustc-args"),
|
||||||
fail_fast: !matches.opt_present("no-fail-fast"),
|
fail_fast: !matches.opt_present("no-fail-fast"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,6 +370,15 @@ impl Subcommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn rustc_args(&self) -> Vec<&str> {
|
||||||
|
match *self {
|
||||||
|
Subcommand::Test { ref rustc_args, .. } => {
|
||||||
|
rustc_args.iter().flat_map(|s| s.split_whitespace()).collect()
|
||||||
|
}
|
||||||
|
_ => Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn fail_fast(&self) -> bool {
|
pub fn fail_fast(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
Subcommand::Test { fail_fast, .. } => fail_fast,
|
Subcommand::Test { fail_fast, .. } => fail_fast,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue