Skip to content

Commit

Permalink
Auto merge of #41968 - kennytm:fix-unreadable-json-test-output-36516,…
Browse files Browse the repository at this point in the history
… r=nikomatsakis

Introduce 'run-pass' header to 'ui' tests in compiletest. Fix issue #36516.

<del>`ui-run` test is a combination of `ui` test and `run-pass` test. It is used to test lint output.</del>

Added support of `// run-pass` header to `ui` tests.

The compiler message of each test must match the corresponding `*.stderr` file like the traditional `ui` tests. Additionally, the compiled output must be executed successfully like the `run-pass` test.

12 `run-pass`/`run-pass-fulldeps` tests are moved to `ui`/`ui-fulldeps` plus the headers. After this move, no `run-pass`/`run-pass-fulldeps` tests should rely on the compiler's JSON message. This allows us to stop passing `--error-format json` in run-pass tests, thus fixing #36516.
  • Loading branch information
bors committed Jun 4, 2017
2 parents efee86d + 3e6c83d commit 1b5a923
Show file tree
Hide file tree
Showing 30 changed files with 250 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/test/codegen/fastcall-inreg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// ignore-tce
// ignore-thumb
// ignore-thumbeb
// ignore-x86_64 no-ignore-x86
// ignore-x86_64
// ignore-xcore
// ignore-nvptx
// ignore-nvptx64
Expand Down
3 changes: 2 additions & 1 deletion src/test/run-pass/i128-ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// ignore-windows

// Ignore 32 bit targets:
// ignore-x86, ignore-arm
// ignore-x86
// ignore-arm

// ignore-emscripten

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

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

Expand Down
6 changes: 6 additions & 0 deletions src/test/ui-fulldeps/deprecated-derive.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: derive(Encodable) is deprecated in favor of derive(RustcEncodable)
--> $DIR/deprecated-derive.rs:18:10
|
18 | #[derive(Encodable)]
| ^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass
// aux-build:lint_group_plugin_test.rs
// ignore-stage1
#![feature(plugin)]
Expand Down
16 changes: 16 additions & 0 deletions src/test/ui-fulldeps/lint-group-plugin.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
warning: item is named 'lintme'
--> $DIR/lint-group-plugin.rs:18:1
|
18 | fn lintme() { } //~ WARNING item is named 'lintme'
| ^^^^^^^^^^^^^^^
|
= note: #[warn(test_lint)] on by default

warning: item is named 'pleaselintme'
--> $DIR/lint-group-plugin.rs:19:1
|
19 | fn pleaselintme() { } //~ WARNING item is named 'pleaselintme'
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(please_lint)] on by default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass
// aux-build:lint_plugin_test.rs
// ignore-stage1
// compile-flags: -A test-lint
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin-cmdline-allow.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: function is never used: `lintme`
--> $DIR/lint-plugin-cmdline-allow.rs:19:1
|
19 | fn lintme() { }
| ^^^^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass
// aux-build:lint_plugin_test.rs
// ignore-stage1
// compile-flags: -Z extra-plugins=lint_plugin_test
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin-cmdline-load.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: item is named 'lintme'
--> $DIR/lint-plugin-cmdline-load.rs:18:1
|
18 | fn lintme() { } //~ WARNING item is named 'lintme'
| ^^^^^^^^^^^^^^^
|
= note: #[warn(test_lint)] on by default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass
// aux-build:lint_plugin_test.rs
// ignore-stage1
#![feature(plugin)]
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui-fulldeps/lint-plugin.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: item is named 'lintme'
--> $DIR/lint-plugin.rs:18:1
|
18 | fn lintme() { } //~ WARNING item is named 'lintme'
| ^^^^^^^^^^^^^^^
|
= note: #[warn(test_lint)] on by default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

mod foo {
#![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
//~^ HELP consider an outer attribute
Expand Down
8 changes: 8 additions & 0 deletions src/test/ui/deprecated-macro_escape-inner.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warning: macro_escape is a deprecated synonym for macro_use
--> $DIR/deprecated-macro_escape-inner.rs:14:5
|
14 | #![macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
| ^^^^^^^^^^^^^^^^
|
= help: consider an outer attribute, #[macro_use] mod ...

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

#[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
mod foo {
}
Expand Down
6 changes: 6 additions & 0 deletions src/test/ui/deprecated-macro_escape.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: macro_escape is a deprecated synonym for macro_use
--> $DIR/deprecated-macro_escape.rs:13:1
|
13 | #[macro_escape] //~ WARNING macro_escape is a deprecated synonym for macro_use
| ^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

#![allow(dead_code)]

#[derive] //~ WARNING empty trait list in `derive`
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/deriving-meta-empty-trait-list.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
warning: empty trait list in `derive`
--> $DIR/deriving-meta-empty-trait-list.rs:15:1
|
15 | #[derive] //~ WARNING empty trait list in `derive`
| ^^^^^^^^^

warning: empty trait list in `derive`
--> $DIR/deriving-meta-empty-trait-list.rs:18:1
|
18 | #[derive()] //~ WARNING empty trait list in `derive`
| ^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//

// run-pass
// ignore-x86
// ignore-arm
// ignore-emscripten
// ^ ignore 32-bit targets, as the error message is target-dependent. see PR #41968.

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

Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/enum-size-variance.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
warning: enum variant is more than three times larger (32 bytes) than the next largest
--> $DIR/enum-size-variance.rs:32:5
|
32 | L(isize, isize, isize, isize), //~ WARNING three times larger
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/enum-size-variance.rs:17:9
|
17 | #![warn(variant_size_differences)]
| ^^^^^^^^^^^^^^^^^^^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_variables)]
Expand Down
16 changes: 16 additions & 0 deletions src/test/ui/issue-19100.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
warning[E0170]: pattern binding `Bar` is named the same as one of the variants of the type `Foo`
--> $DIR/issue-19100.rs:27:1
|
27 | Bar if true
| ^^^
|
= help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Bar`

warning[E0170]: pattern binding `Baz` is named the same as one of the variants of the type `Foo`
--> $DIR/issue-19100.rs:32:1
|
32 | Baz if false
| ^^^
|
= help: if you meant to match on a variant, consider making the path in the pattern qualified: `Foo::Baz`

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass

// Parser test for #37765

fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
Expand Down
28 changes: 28 additions & 0 deletions src/test/ui/path-lookahead.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
warning: unnecessary parentheses around `return` value
--> $DIR/path-lookahead.rs:16:10
|
16 | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(unused_parens)] on by default

warning: function is never used: `with_parens`
--> $DIR/path-lookahead.rs:15:1
|
15 | / fn with_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `with_parens`
16 | | return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
17 | | }
| |_^
|
= note: #[warn(dead_code)] on by default

warning: function is never used: `no_parens`
--> $DIR/path-lookahead.rs:19:1
|
19 | / fn no_parens<T: ToString>(arg: T) -> String { //~WARN function is never used: `no_parens`
20 | | return <T as ToString>::to_string(&arg);
21 | | }
| |_^
|
= note: #[warn(dead_code)] on by default

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// run-pass
// compile-flags: --test

#[test]
Expand Down
40 changes: 40 additions & 0 deletions src/test/ui/test-should-panic-attr.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
warning: attribute must be of the form: `#[should_panic]` or `#[should_panic(expected = "error message")]`
--> $DIR/test-should-panic-attr.rs:15:1
|
15 | #[should_panic = "foo"]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.

warning: argument must be of the form: `expected = "error message"`
--> $DIR/test-should-panic-attr.rs:22:1
|
22 | #[should_panic(expected)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.

warning: argument must be of the form: `expected = "error message"`
--> $DIR/test-should-panic-attr.rs:29:1
|
29 | #[should_panic(expect)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.

warning: argument must be of the form: `expected = "error message"`
--> $DIR/test-should-panic-attr.rs:36:1
|
36 | #[should_panic(expected(foo, bar))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.

warning: argument must be of the form: `expected = "error message"`
--> $DIR/test-should-panic-attr.rs:43:1
|
43 | #[should_panic(expected = "foo", bar)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: Errors in this attribute were erroneously allowed and will become a hard error in a future release.

Loading

0 comments on commit 1b5a923

Please sign in to comment.