diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2014-02-19 17:11:36 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2014-02-19 17:12:37 +0100 |
| commit | 6656e5cd45e00b1707badbfb188aafd03eb7ab72 (patch) | |
| tree | ef93310410907b49cf997001199d6536c214682b | |
| parent | 3ce04dc71957d013b668f0b9cad9d40332daa1e8 (diff) | |
debuginfo: Fix a RUSTFLAGS incompatibility in test runner.
| -rw-r--r-- | src/compiletest/runtest.rs | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index 8b45d987864..abb0ea5a557 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -258,15 +258,12 @@ actual:\n\ } fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { - - // do not optimize debuginfo tests - let mut config = match config.target_rustcflags { - Some(ref flags) => config { - target_rustcflags: Some(flags.replace("-O", "")), - .. (*config).clone() - }, - None => (*config).clone() + let mut config = config { + target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags), + host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags), + .. config.clone() }; + let config = &mut config; let check_lines = &props.check_lines; let mut cmds = props.debugger_cmds.connect("\n"); @@ -436,6 +433,20 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) { check_lines[i]), &ProcRes); } } + + fn cleanup_debug_info_options(options: &Option<~str>) -> Option<~str> { + if options.is_none() { + return None; + } + + // Remove options that are either unwanted (-O) or may lead to duplicates due to RUSTFLAGS. + let options_to_remove = [~"-O", ~"-g", ~"--debuginfo"]; + let new_options = split_maybe_args(options).move_iter() + .filter(|x| !options_to_remove.contains(x)) + .to_owned_vec() + .connect(" "); + Some(new_options) + } } fn check_error_patterns(props: &TestProps, |
