Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiletest normalization: preserve non-JSON lines such as ICEs #59769

Merged
merged 9 commits into from
Apr 16, 2019
2 changes: 1 addition & 1 deletion src/librustc_mir/interpret/validity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
match self.ecx.memory.check_align(ptr, align) {
Ok(_) => {},
Err(err) => {
error!("{:?} is not aligned to {:?}", ptr, align);
info!("{:?} is not aligned to {:?}", ptr, align);
match err.kind {
InterpError::InvalidNullPointerUsage =>
return validation_failure!("NULL reference", self.path),
Expand Down
6 changes: 4 additions & 2 deletions src/test/run-pass/backtrace-debuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
// ignore-pretty issue #37195
// ignore-cloudabi spawning processes is not supported
// ignore-emscripten spawning processes is not supported
// normalize-stderr-test ".*\n" -> ""

// note that above `-opt-bisect-limit=0` is used to basically disable
// optimizations
// Note that above `-opt-bisect-limit=0` is used to basically disable
// optimizations. It creates tons of output on stderr, hence we normalize
// that away entirely.

use std::env;

Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-arg-invalid-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`)

2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-arg-invalid-2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`)

2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-arg-invalid-3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `a::b` (argument key must be an identifier)

2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-arg-invalid-4.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`)

2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-arg-invalid-5.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `a=10` (argument value must be a string)

2 changes: 2 additions & 0 deletions src/test/ui/conditional-compilation/cfg-empty-codemap.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: invalid `--cfg` argument: `""` (expected `key` or `key="value"`)

4 changes: 4 additions & 0 deletions src/test/ui/duplicate/dupe-symbols-7.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//
// error-pattern: entry symbol `main` defined multiple times

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
#![allow(warnings)]

#[no_mangle]
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/duplicate/dupe-symbols-7.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: entry symbol `main` defined multiple times
--> $DIR/dupe-symbols-7.rs:6:1
--> $DIR/dupe-symbols-7.rs:10:1
|
LL | fn main(){}
| ^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/huge-array-simple.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// error-pattern: too big for the current architecture

// normalize-stderr-test "; \d+]" -> "; N]"

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
#![allow(exceeding_bitshifts)]

#[cfg(target_pointer_width = "64")]
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/huge-array.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// error-pattern:; 1518600000

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

fn generic<T: Copy>(t: T) {
let s: [T; 1518600000] = [t; 1518600000];
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/huge-enum.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE"
// normalize-stderr-test "\[u32; \d+\]" -> "TYPE"

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#[cfg(target_pointer_width = "32")]
fn main() {
let big: Option<[u32; (1<<29)-1]> = None;
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/huge-struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// normalize-stderr-test "S1M" -> "SXX"
// error-pattern: too big for the current

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

struct S32<T> {
v0: T,
v1: T,
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-15919.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// error-pattern: too big for the current architecture
// normalize-stderr-test "\[usize; \d+\]" -> "[usize; N]"

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#[cfg(target_pointer_width = "32")]
fn main() {
let x = [0usize; 0xffff_ffff];
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-17913.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]"
// error-pattern: too big for the current architecture

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#![feature(box_syntax)]

#[cfg(target_pointer_width = "64")]
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/issues/issue-56762.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// only-x86_64

// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""
const HUGE_SIZE: usize = !0usize / 8;


Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/linkage2.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#![feature(linkage)]

extern {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/linkage2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: must have type `*const T` or `*mut T`
--> $DIR/linkage2.rs:4:32
--> $DIR/linkage2.rs:8:32
|
LL | #[linkage = "extern_weak"] static foo: i32;
| ^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/linkage3.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// FIXME https://github.com/rust-lang/rust/issues/59774
// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#![feature(linkage)]

extern {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/linkage3.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: invalid linkage specified
--> $DIR/linkage3.rs:4:24
--> $DIR/linkage3.rs:8:24
|
LL | #[linkage = "foo"] static foo: *const i32;
| ^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/pattern/const-pat-ice.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// failure-status: 101
// rustc-env:RUST_BACKTRACE=0
// normalize-stderr-test "note: rustc 1.* running on .*" -> "note: rustc VERSION running on TARGET"
// normalize-stderr-test "note: compiler flags: .*" -> "note: compiler flags: FLAGS"

// This is a repro test for an ICE in our pattern handling of constants.

Expand Down
13 changes: 13 additions & 0 deletions src/test/ui/pattern/const-pat-ice.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', src/librustc_mir/hair/pattern/_match.rs:1069:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc VERSION running on TARGET

note: compiler flags: FLAGS

4 changes: 4 additions & 0 deletions src/test/ui/proc-macro/invalid-punct-ident-1.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// aux-build:invalid-punct-ident.rs

// FIXME https://github.com/rust-lang/rust/issues/59998
// normalize-stderr-test "thread.*panicked.*proc_macro_server.rs.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#[macro_use]
extern crate invalid_punct_ident;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/invalid-punct-ident-1.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: proc macro panicked
--> $DIR/invalid-punct-ident-1.rs:6:1
--> $DIR/invalid-punct-ident-1.rs:10:1
|
LL | invalid_punct!();
| ^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/proc-macro/invalid-punct-ident-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// aux-build:invalid-punct-ident.rs

// FIXME https://github.com/rust-lang/rust/issues/59998
// normalize-stderr-test "thread.*panicked.*proc_macro_server.rs.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#[macro_use]
extern crate invalid_punct_ident;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/invalid-punct-ident-2.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: proc macro panicked
--> $DIR/invalid-punct-ident-2.rs:6:1
--> $DIR/invalid-punct-ident-2.rs:10:1
|
LL | invalid_ident!();
| ^^^^^^^^^^^^^^^^^
Expand Down
4 changes: 4 additions & 0 deletions src/test/ui/proc-macro/invalid-punct-ident-3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// aux-build:invalid-punct-ident.rs

// FIXME https://github.com/rust-lang/rust/issues/59998
// normalize-stderr-test "thread.*panicked.*proc_macro_server.rs.*\n" -> ""
// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> ""

#[macro_use]
extern crate invalid_punct_ident;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/proc-macro/invalid-punct-ident-3.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: proc macro panicked
--> $DIR/invalid-punct-ident-3.rs:6:1
--> $DIR/invalid-punct-ident-3.rs:10:1
|
LL | invalid_raw_ident!();
| ^^^^^^^^^^^^^^^^^^^^^
Expand Down
3 changes: 2 additions & 1 deletion src/tools/compiletest/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ pub fn extract_rendered(output: &str, proc_res: &ProcRes) -> String {
}
}
} else {
None
// preserve non-JSON lines, such as ICEs
Some(format!("{}\n", line))
}
})
.collect()
Expand Down