Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added run_flags directive to compiletest #13553

Merged
merged 1 commit into from
Apr 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub struct TestProps {
pub error_patterns: Vec<~str> ,
// Extra flags to pass to the compiler
pub compile_flags: Option<~str>,
// Extra flags to pass when the compiled code is run (such as --bench)
pub run_flags: Option<~str>,
// If present, the name of a file that this test should match when
// pretty-printed
pub pp_exact: Option<Path>,
Expand All @@ -42,6 +44,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
let mut aux_builds = Vec::new();
let mut exec_env = Vec::new();
let mut compile_flags = None;
let mut run_flags = None;
let mut pp_exact = None;
let mut debugger_cmds = Vec::new();
let mut check_lines = Vec::new();
Expand All @@ -58,6 +61,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
compile_flags = parse_compile_flags(ln);
}

if run_flags.is_none() {
run_flags = parse_run_flags(ln);
}

if pp_exact.is_none() {
pp_exact = parse_pp_exact(ln, testfile);
}
Expand Down Expand Up @@ -96,9 +103,11 @@ pub fn load_props(testfile: &Path) -> TestProps {

true
});
return TestProps {

TestProps {
error_patterns: error_patterns,
compile_flags: compile_flags,
run_flags: run_flags,
pp_exact: pp_exact,
aux_builds: aux_builds,
exec_env: exec_env,
Expand All @@ -107,7 +116,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
force_host: force_host,
check_stdout: check_stdout,
no_prefer_dynamic: no_prefer_dynamic,
};
}
}

pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
Expand Down Expand Up @@ -160,6 +169,10 @@ fn parse_compile_flags(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"compile-flags")
}

fn parse_run_flags(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"run-flags")
}

fn parse_debugger_cmd(line: &str) -> Option<~str> {
parse_name_value_directive(line, ~"debugger")
}
Expand Down
7 changes: 6 additions & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,14 +834,19 @@ fn make_exe_name(config: &config, testfile: &Path) -> Path {
f
}

fn make_run_args(config: &config, _props: &TestProps, testfile: &Path) ->
fn make_run_args(config: &config, props: &TestProps, testfile: &Path) ->
ProcArgs {
// If we've got another tool to run under (valgrind),
// then split apart its command
let mut args = split_maybe_args(&config.runtool);
let exe_file = make_exe_name(config, testfile);

// FIXME (#9639): This needs to handle non-utf8 paths
args.push(exe_file.as_str().unwrap().to_owned());

// Add the arguments in the run_flags directive
args.push_all_move(split_maybe_args(&props.run_flags));

let prog = args.shift().unwrap();
return ProcArgs {prog: prog, args: args};
}
Expand Down