Skip to content

Commit

Permalink
make sure we test panic of interpreter-impelemted align_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 16, 2020
1 parent d4e5943 commit 0913653
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 4 additions & 1 deletion tests/run-pass/panic/catch_panic.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// normalize-stderr-test "[^ ]*core/[a-z_/]+.rs[0-9:]*" -> "$$LOC"
// normalize-stderr-test "catch_panic\.rs:[0-9]{2}" -> "catch_panic.rs:LL"
// We test the `align_offset` panic below, make sure we test the interpreter impl and not the "real" one.
// compile-flags: -Zmiri-symbolic-alignment-check
#![feature(never_type)]
#![allow(unconditional_panic)]

Expand Down Expand Up @@ -99,7 +102,7 @@ fn test(expect_msg: Option<&str>, do_panic: impl FnOnce(usize) -> !) {
eprintln!("Caught panic message (&str): {}", s);
Some(*s)
} else {
eprintln!("Failed get caught panic message.");
eprintln!("Failed to get caught panic message.");
None
};
if let Some(expect_msg) = expect_msg {
Expand Down
24 changes: 12 additions & 12 deletions tests/run-pass/panic/catch_panic.stderr
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:50:27
thread 'main' panicked at 'Hello from panic: std', $DIR/catch_panic.rs:LL:27
Caught panic message (&str): Hello from panic: std
thread 'main' panicked at 'Hello from panic: 1', $DIR/catch_panic.rs:51:26
thread 'main' panicked at 'Hello from panic: 1', $DIR/catch_panic.rs:LL:26
Caught panic message (String): Hello from panic: 1
thread 'main' panicked at 'Hello from panic: 2', $DIR/catch_panic.rs:52:26
thread 'main' panicked at 'Hello from panic: 2', $DIR/catch_panic.rs:LL:26
Caught panic message (String): Hello from panic: 2
thread 'main' panicked at 'Box<Any>', $DIR/catch_panic.rs:53:27
Failed get caught panic message.
thread 'main' panicked at 'Hello from panic: core', $DIR/catch_panic.rs:56:27
thread 'main' panicked at 'Box<Any>', $DIR/catch_panic.rs:LL:27
Failed to get caught panic message.
thread 'main' panicked at 'Hello from panic: core', $DIR/catch_panic.rs:LL:27
Caught panic message (String): Hello from panic: core
thread 'main' panicked at 'Hello from panic: 5', $DIR/catch_panic.rs:57:26
thread 'main' panicked at 'Hello from panic: 5', $DIR/catch_panic.rs:LL:26
Caught panic message (String): Hello from panic: 5
thread 'main' panicked at 'Hello from panic: 6', $DIR/catch_panic.rs:58:26
thread 'main' panicked at 'Hello from panic: 6', $DIR/catch_panic.rs:LL:26
Caught panic message (String): Hello from panic: 6
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4', $DIR/catch_panic.rs:63:33
thread 'main' panicked at 'index out of bounds: the len is 3 but the index is 4', $DIR/catch_panic.rs:LL:33
Caught panic message (String): index out of bounds: the len is 3 but the index is 4
thread 'main' panicked at 'attempt to divide by zero', $DIR/catch_panic.rs:67:33
thread 'main' panicked at 'attempt to divide by zero', $DIR/catch_panic.rs:LL:33
Caught panic message (String): attempt to divide by zero
thread 'main' panicked at 'align_offset: align is not a power-of-two', $LOC
Caught panic message (String): align_offset: align is not a power-of-two
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:76:29
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:29
Caught panic message (&str): assertion failed: false
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:77:29
thread 'main' panicked at 'assertion failed: false', $DIR/catch_panic.rs:LL:29
Caught panic message (&str): assertion failed: false
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', $LOC
Caught panic message (String): called `Option::unwrap()` on a `None` value
Expand Down

0 comments on commit 0913653

Please sign in to comment.