diff options
Diffstat (limited to 'tests/ui/backtrace.rs')
-rw-r--r-- | tests/ui/backtrace.rs | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/ui/backtrace.rs b/tests/ui/backtrace.rs index 66b378f62..84be333be 100644 --- a/tests/ui/backtrace.rs +++ b/tests/ui/backtrace.rs @@ -94,27 +94,30 @@ fn runtest(me: &str) { #[cfg(not(panic = "abort"))] { // Make sure a stack trace is printed - let p = template(me).arg("double-fail").spawn().unwrap(); + let p = template(me).arg("double-fail").env("RUST_BACKTRACE","0").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); let s = str::from_utf8(&out.stderr).unwrap(); // loosened the following from double::h to double:: due to // spurious failures on mac, 32bit, optimized - assert!(s.contains("stack backtrace") && contains_verbose_expected(s, "double"), - "bad output3: {}", s); + assert!( + s.contains("stack backtrace") && + s.contains("panic in a destructor during cleanup") && + contains_verbose_expected(s, "double"), + "bad output3: {}", s + ); + // Make sure it's only one stack trace. + assert_eq!(s.split("stack backtrace").count(), 2); // Make sure a stack trace isn't printed too many times - // - // Currently it is printed 3 times ("once", "twice" and "panic in a - // function that cannot unwind") but in the future the last one may be - // removed. + // even with RUST_BACKTRACE=1. It should be printed twice. let p = template(me).arg("double-fail") .env("RUST_BACKTRACE", "1").spawn().unwrap(); let out = p.wait_with_output().unwrap(); assert!(!out.status.success()); let s = str::from_utf8(&out.stderr).unwrap(); let mut i = 0; - for _ in 0..3 { + for _ in 0..2 { i += s[i + 10..].find("stack backtrace").unwrap() + 10; } assert!(s[i + 10..].find("stack backtrace").is_none(), |