Skip to content

Commit 6342aa6

Browse files
committed
Ignore extra error from test for now
1 parent f4a2672 commit 6342aa6

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

src/compiletest/header.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ pub struct TestProps {
4242
pub pretty_compare_only: bool,
4343
// Patterns which must not appear in the output of a cfail test.
4444
pub forbid_output: Vec<String>,
45+
// Ignore errors which originate from a command line span
46+
pub ignore_command_line: bool,
4547
}
4648

4749
// Load any test directives embedded in the file
@@ -60,6 +62,8 @@ pub fn load_props(testfile: &Path) -> TestProps {
6062
let mut pretty_mode = None;
6163
let mut pretty_compare_only = false;
6264
let mut forbid_output = Vec::new();
65+
let mut ignore_command_line = false;
66+
6367
iter_header(testfile, |ln| {
6468
match parse_error_pattern(ln) {
6569
Some(ep) => error_patterns.push(ep),
@@ -102,6 +106,10 @@ pub fn load_props(testfile: &Path) -> TestProps {
102106
pretty_compare_only = parse_pretty_compare_only(ln);
103107
}
104108

109+
if !ignore_command_line {
110+
ignore_command_line = parse_ignore_command_line(ln);
111+
}
112+
105113
match parse_aux_build(ln) {
106114
Some(ab) => { aux_builds.push(ab); }
107115
None => {}
@@ -140,6 +148,7 @@ pub fn load_props(testfile: &Path) -> TestProps {
140148
pretty_mode: pretty_mode.unwrap_or("normal".to_string()),
141149
pretty_compare_only: pretty_compare_only,
142150
forbid_output: forbid_output,
151+
ignore_command_line: ignore_command_line,
143152
}
144153
}
145154

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

303+
fn parse_ignore_command_line(line: &str) -> bool {
304+
parse_name_directive(line, "ignore-command-line")
305+
}
306+
294307
fn parse_exec_env(line: &str) -> Option<(String, String)> {
295308
parse_name_value_directive(line, "exec-env").map(|nv| {
296309
// nv is either FOO or FOO=BAR

src/compiletest/runtest.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) {
104104
if !props.error_patterns.is_empty() {
105105
fatal("both error pattern and expected errors specified");
106106
}
107-
check_expected_errors(expected_errors, testfile, &proc_res);
107+
check_expected_errors(props, expected_errors, testfile, &proc_res);
108108
} else {
109109
check_error_patterns(props, testfile, output_to_check.as_slice(), &proc_res);
110110
}
@@ -941,7 +941,8 @@ fn check_forbid_output(props: &TestProps,
941941
}
942942
}
943943

944-
fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
944+
fn check_expected_errors(props: &TestProps,
945+
expected_errors: Vec<errors::ExpectedError> ,
945946
testfile: &Path,
946947
proc_res: &ProcRes) {
947948

@@ -996,6 +997,11 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
996997
was_expected = true;
997998
}
998999

1000+
if line.starts_with("<command line option>") &&
1001+
props.ignore_command_line {
1002+
was_expected = true;
1003+
}
1004+
9991005
if !was_expected && is_compiler_error_or_warning(line) {
10001006
fatal_proc_rec(format!("unexpected compiler error or warning: '{}'",
10011007
line).as_slice(),

src/test/compile-fail/recursion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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

0 commit comments

Comments
 (0)