compiletest: Allow multiple //@ run-flags:
headers
This commit is contained in:
parent
67caf52fbc
commit
2692d44d83
3 changed files with 12 additions and 10 deletions
|
@ -94,7 +94,7 @@ pub struct TestProps {
|
|||
// Extra flags to pass to the compiler
|
||||
pub compile_flags: Vec<String>,
|
||||
// Extra flags to pass when the compiled code is run (such as --bench)
|
||||
pub run_flags: Option<String>,
|
||||
pub run_flags: Vec<String>,
|
||||
// If present, the name of a file that this test should match when
|
||||
// pretty-printed
|
||||
pub pp_exact: Option<PathBuf>,
|
||||
|
@ -262,7 +262,7 @@ impl TestProps {
|
|||
error_patterns: vec![],
|
||||
regex_error_patterns: vec![],
|
||||
compile_flags: vec![],
|
||||
run_flags: None,
|
||||
run_flags: vec![],
|
||||
pp_exact: None,
|
||||
aux_builds: vec![],
|
||||
aux_bins: vec![],
|
||||
|
@ -399,7 +399,9 @@ impl TestProps {
|
|||
|
||||
config.parse_and_update_revisions(ln, &mut self.revisions);
|
||||
|
||||
config.set_name_value_directive(ln, RUN_FLAGS, &mut self.run_flags, |r| r);
|
||||
if let Some(flags) = config.parse_name_value_directive(ln, RUN_FLAGS) {
|
||||
self.run_flags.extend(split_flags(&flags));
|
||||
}
|
||||
|
||||
if self.pp_exact.is_none() {
|
||||
self.pp_exact = config.parse_pp_exact(ln, testfile);
|
||||
|
|
|
@ -2355,7 +2355,7 @@ impl<'test> TestCx<'test> {
|
|||
args.push(exe_file.into_os_string());
|
||||
|
||||
// Add the arguments in the run_flags directive
|
||||
args.extend(self.split_maybe_args(&self.props.run_flags));
|
||||
args.extend(self.props.run_flags.iter().map(OsString::from));
|
||||
|
||||
let prog = args.remove(0);
|
||||
ProcArgs { prog, args }
|
||||
|
@ -4173,10 +4173,12 @@ impl<'test> TestCx<'test> {
|
|||
}
|
||||
|
||||
fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> String {
|
||||
let rflags = self.props.run_flags.as_ref();
|
||||
// Crude heuristic to detect when the output should have JSON-specific
|
||||
// normalization steps applied.
|
||||
let rflags = self.props.run_flags.join(" ");
|
||||
let cflags = self.props.compile_flags.join(" ");
|
||||
let json = rflags
|
||||
.map_or(false, |s| s.contains("--format json") || s.contains("--format=json"))
|
||||
let json = rflags.contains("--format json")
|
||||
|| rflags.contains("--format=json")
|
||||
|| cflags.contains("--error-format json")
|
||||
|| cflags.contains("--error-format pretty-json")
|
||||
|| cflags.contains("--error-format=json")
|
||||
|
|
|
@ -123,9 +123,7 @@ If you want to install the `browser-ui-test` dependency, run `npm install browse
|
|||
cargo.env("RUSTDOCFLAGS", test_props.compile_flags.join(" "));
|
||||
}
|
||||
|
||||
if let Some(flags) = &test_props.run_flags {
|
||||
cargo.arg(flags);
|
||||
}
|
||||
cargo.args(&test_props.run_flags);
|
||||
}
|
||||
|
||||
if try_run(&mut cargo, config.verbose).is_err() {
|
||||
|
|
Loading…
Add table
Reference in a new issue