change compile_flags to eagerly split into a vector on whitespace

This commit is contained in:
Niko Matsakis 2016-03-01 21:09:36 -05:00
parent c76125742a
commit d78b4a9350
2 changed files with 11 additions and 9 deletions

View file

@ -22,7 +22,7 @@ pub struct TestProps {
// Lines that should be expected, in order, on standard out
pub error_patterns: Vec<String> ,
// Extra flags to pass to the compiler
pub compile_flags: Option<String>,
pub compile_flags: Vec<String>,
// Extra flags to pass when the compiled code is run (such as --bench)
pub run_flags: Option<String>,
// If present, the name of a file that this test should match when
@ -57,7 +57,6 @@ pub fn load_props(testfile: &Path) -> TestProps {
let error_patterns = Vec::new();
let aux_builds = Vec::new();
let exec_env = Vec::new();
let compile_flags = None;
let run_flags = None;
let pp_exact = None;
let check_lines = Vec::new();
@ -70,7 +69,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
let forbid_output = Vec::new();
let mut props = TestProps {
error_patterns: error_patterns,
compile_flags: compile_flags,
compile_flags: vec![],
run_flags: run_flags,
pp_exact: pp_exact,
aux_builds: aux_builds,
@ -95,8 +94,11 @@ pub fn load_props_into(props: &mut TestProps, testfile: &Path) {
props.error_patterns.push(ep);
}
if props.compile_flags.is_none() {
props.compile_flags = parse_compile_flags(ln);
if let Some(flags) = parse_compile_flags(ln) {
props.compile_flags.extend(
flags
.split_whitespace()
.map(|s| s.to_owned()));
}
if props.run_flags.is_none() {

View file

@ -275,7 +275,7 @@ fn run_pretty_test(config: &Config, props: &TestProps, testpaths: &TestPaths) {
"-L".to_owned(),
aux_dir.to_str().unwrap().to_owned());
args.extend(split_maybe_args(&config.target_rustcflags));
args.extend(split_maybe_args(&props.compile_flags));
args.extend(props.compile_flags.iter().cloned());
return ProcArgs {
prog: config.rustc_path.to_str().unwrap().to_owned(),
args: args,
@ -322,7 +322,7 @@ actual:\n\
"-L".to_owned(),
aux_dir.to_str().unwrap().to_owned());
args.extend(split_maybe_args(&config.target_rustcflags));
args.extend(split_maybe_args(&props.compile_flags));
args.extend(props.compile_flags.iter().cloned());
// FIXME (#9639): This needs to handle non-utf8 paths
return ProcArgs {
prog: config.rustc_path.to_str().unwrap().to_owned(),
@ -1184,7 +1184,7 @@ fn document(config: &Config,
"-o".to_owned(),
out_dir.to_str().unwrap().to_owned(),
testpaths.file.to_str().unwrap().to_owned()];
args.extend(split_maybe_args(&props.compile_flags));
args.extend(props.compile_flags.iter().cloned());
let args = ProcArgs {
prog: config.rustdoc_path.to_str().unwrap().to_owned(),
args: args,
@ -1369,7 +1369,7 @@ fn make_compile_args<F>(config: &Config,
} else {
args.extend(split_maybe_args(&config.target_rustcflags));
}
args.extend(split_maybe_args(&props.compile_flags));
args.extend(props.compile_flags.iter().cloned());
return ProcArgs {
prog: config.rustc_path.to_str().unwrap().to_owned(),
args: args,