Skip to content

Commit

Permalink
Fix compiletest so it respects warnings for run-pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedcharles committed Aug 22, 2016
1 parent 197be89 commit 6961d26
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/test/run-pass-fulldeps/deprecated-derive.rs
Expand Up @@ -9,6 +9,7 @@
// except according to those terms.

#![feature(rustc_private)]
#![allow(dead_code)]

extern crate serialize;

Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass-fulldeps/lint-group-plugin.rs
Expand Up @@ -14,6 +14,7 @@

#![feature(plugin)]
#![plugin(lint_group_plugin_test)]
#![allow(dead_code)]

fn lintme() { } //~ WARNING item is named 'lintme'
fn pleaselintme() { } //~ WARNING item is named 'pleaselintme'
Expand Down
2 changes: 2 additions & 0 deletions src/test/run-pass-fulldeps/lint-plugin-cmdline-load.rs
Expand Up @@ -13,6 +13,8 @@
// ignore-pretty: Random space appears with the pretty test
// compile-flags: -Z extra-plugins=lint_plugin_test

#![allow(dead_code)]

fn lintme() { } //~ WARNING item is named 'lintme'

#[allow(test_lint)]
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass-fulldeps/lint-plugin.rs
Expand Up @@ -14,6 +14,7 @@

#![feature(plugin)]
#![plugin(lint_plugin_test)]
#![allow(dead_code)]

fn lintme() { } //~ WARNING item is named 'lintme'

Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/attr-before-view-item.rs
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:expected item

// pretty-expanded FIXME #23616

#![feature(custom_attribute, test)]
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/attr-before-view-item2.rs
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:expected item

// pretty-expanded FIXME #23616

#![feature(custom_attribute, test)]
Expand Down
1 change: 1 addition & 0 deletions src/test/run-pass/deriving-meta-empty-trait-list.rs
Expand Up @@ -10,6 +10,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(dead_code)]

#[derive] //~ WARNING empty trait list in `derive`
struct Foo;
Expand Down
8 changes: 4 additions & 4 deletions src/test/run-pass/enum-size-variance.rs
Expand Up @@ -10,7 +10,7 @@
//
// ignore-pretty

#![deny(enum_size_variance)]
#![warn(variant_size_differences)]
#![allow(dead_code)]

enum Enum1 { }
Expand All @@ -21,8 +21,8 @@ enum Enum3 { D(isize), E, F }

enum Enum4 { H(isize), I(isize), J }

enum Enum5 { //~ ERROR three times larger
L(isize, isize, isize, isize), //~ NOTE this variant is the largest
enum Enum5 {
L(isize, isize, isize, isize), //~ WARNING three times larger
M(isize),
N
}
Expand All @@ -33,7 +33,7 @@ enum Enum6<T, U> {
Q(isize)
}

#[allow(enum_size_variance)]
#[allow(variant_size_differences)]
enum Enum7 {
R(isize, isize, isize, isize),
S(isize),
Expand Down
4 changes: 4 additions & 0 deletions src/test/run-pass/issue-19100.rs
Expand Up @@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]

#[derive(Copy, Clone)]
enum Foo {
Bar,
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/issue-25757.rs
Expand Up @@ -22,6 +22,6 @@ const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x;

fn main() {
let mut foo = Foo { a: 137 };
FUNC(&mut foo); //~ ERROR bad
FUNC(&mut foo);
assert_eq!(foo.a, 5);
}
1 change: 0 additions & 1 deletion src/test/run-pass/issue-2611-3.rs
Expand Up @@ -22,7 +22,6 @@ struct E {

impl A for E {
fn b<F,G>(&self, _x: F) -> F { panic!() }
//~^ ERROR in method `b`, type parameter 0 has 1 bound, but
}

pub fn main() {}
3 changes: 3 additions & 0 deletions src/test/run-pass/issue-27320.rs
Expand Up @@ -8,6 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(unused_variables)]
#![allow(dead_code)]

macro_rules! piece(
($piece:pat) => ($piece);
);
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/liveness-assign-imm-local-after-ret.rs
Expand Up @@ -10,13 +10,13 @@

// pretty-expanded FIXME #23616

#![allow(unreachable_code)]
#![allow(dead_code)]

fn test() {
let _v: isize;
_v = 1;
return;
_v = 2; //~ WARNING: unreachable statement
_v = 2;
}

pub fn main() {
Expand Down
4 changes: 2 additions & 2 deletions src/test/run-pass/unreachable-code-1.rs
Expand Up @@ -9,14 +9,14 @@
// except according to those terms.


#![allow(unreachable_code)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn id(x: bool) -> bool { x }

fn call_id() {
let c = panic!();
id(c); //~ WARNING unreachable statement
id(c);
}

fn call_id_3() { id(return) && id(return); }
Expand Down
10 changes: 8 additions & 2 deletions src/tools/compiletest/src/runtest.rs
Expand Up @@ -197,6 +197,11 @@ impl<'test> TestCx<'test> {
self.fatal_proc_rec("compilation failed!", &proc_res);
}

let expected_errors = errors::load_errors(&self.testpaths.file, self.revision);
if !expected_errors.is_empty() {
self.check_expected_errors(expected_errors, &proc_res);
}

let proc_res = self.exec_compiled_test();

if !proc_res.status.success() {
Expand Down Expand Up @@ -992,7 +997,8 @@ actual:\n\
fn check_expected_errors(&self,
expected_errors: Vec<errors::Error>,
proc_res: &ProcRes) {
if proc_res.status.success() {
if proc_res.status.success() &&
expected_errors.iter().any(|x| x.kind == Some(ErrorKind::Error)) {
self.fatal_proc_rec("process did not return an error status", proc_res);
}

Expand Down Expand Up @@ -1320,6 +1326,7 @@ actual:\n\
match self.config.mode {
CompileFail |
ParseFail |
RunPass |
Incremental => {
// If we are extracting and matching errors in the new
// fashion, then you want JSON mode. Old-skool error
Expand Down Expand Up @@ -1350,7 +1357,6 @@ actual:\n\
args.push(dir_opt);
}
RunFail |
RunPass |
RunPassValgrind |
Pretty |
DebugInfoGdb |
Expand Down

0 comments on commit 6961d26

Please sign in to comment.