Skip to content

Commit

Permalink
Ignore extra error from test for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jan 8, 2015
1 parent f4a2672 commit 6342aa6
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
13 changes: 13 additions & 0 deletions src/compiletest/header.rs
Expand Up @@ -42,6 +42,8 @@ pub struct TestProps {
pub pretty_compare_only: bool,
// Patterns which must not appear in the output of a cfail test.
pub forbid_output: Vec<String>,
// Ignore errors which originate from a command line span
pub ignore_command_line: bool,
}

// Load any test directives embedded in the file
Expand All @@ -60,6 +62,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
let mut pretty_mode = None;
let mut pretty_compare_only = false;
let mut forbid_output = Vec::new();
let mut ignore_command_line = false;

iter_header(testfile, |ln| {
match parse_error_pattern(ln) {
Some(ep) => error_patterns.push(ep),
Expand Down Expand Up @@ -102,6 +106,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
pretty_compare_only = parse_pretty_compare_only(ln);
}

if !ignore_command_line {
ignore_command_line = parse_ignore_command_line(ln);
}

match parse_aux_build(ln) {
Some(ab) => { aux_builds.push(ab); }
None => {}
Expand Down Expand Up @@ -140,6 +148,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
pretty_compare_only: pretty_compare_only,
forbid_output: forbid_output,
ignore_command_line: ignore_command_line,
}
}

Expand Down Expand Up @@ -291,6 +300,10 @@ fn parse_pretty_compare_only(line: &str) -> bool {
parse_name_directive(line, "pretty-compare-only")
}

fn parse_ignore_command_line(line: &str) -> bool {
parse_name_directive(line, "ignore-command-line")
}

fn parse_exec_env(line: &str) -> Option<(String, String)> {
parse_name_value_directive(line, "exec-env").map(|nv| {
// nv is either FOO or FOO=BAR
Expand Down
10 changes: 8 additions & 2 deletions src/compiletest/runtest.rs
Expand Up @@ -104,7 +104,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
if !props.error_patterns.is_empty() {
fatal("both error pattern and expected errors specified");
}
check_expected_errors(expected_errors, testfile, &proc_res);
check_expected_errors(props, expected_errors, testfile, &proc_res);
} else {
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
}
Expand Down Expand Up @@ -941,7 +941,8 @@ fn check_forbid_output(props: &TestProps,
}
}

fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
fn check_expected_errors(props: &TestProps,
expected_errors: Vec<errors::ExpectedError> ,
testfile: &Path,
proc_res: &ProcRes) {

Expand Down Expand Up @@ -996,6 +997,11 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
was_expected = true;
}

if line.starts_with("<command line option>") &&
props.ignore_command_line {
was_expected = true;
}

if !was_expected && is_compiler_error_or_warning(line) {
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
line).as_slice(),
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/recursion.rs
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//~^^^^^^^^^^ ERROR overflow
// ignore-command-line: See https://github.com/rust-lang/rust/issues/20747
//
// We also get a second error message at the top of file (dummy
// span). This is not helpful, but also kind of annoying to prevent,
Expand Down

7 comments on commit 6342aa6

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at Manishearth@6342aa6

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging Manishearth/rust/plugin-loader = 6342aa6 into auto

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status: {"merge_sha": "a8a210b57ef6b2f5f66b8798c80acfde70c9d2e7"}

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manishearth/rust/plugin-loader = 6342aa6 merged ok, testing candidate = a8a210b

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a8a210b

@bors
Copy link
Contributor

@bors bors commented on 6342aa6 Jan 8, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a8a210b

Please sign in to comment.