]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/multi-panic.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 fn check_for_no_backtrace(test
: std
::process
::Output
) {
14 assert
!(!test
.status
.success());
15 let err
= String
::from_utf8_lossy(&test
.stderr
);
16 let mut it
= err
.lines();
18 assert_eq
!(it
.next().map(|l
| l
.starts_with("thread '<unnamed>' panicked at")), Some(true));
19 assert_eq
!(it
.next(), Some("note: Run with `RUST_BACKTRACE=1` for a backtrace."));
20 assert_eq
!(it
.next().map(|l
| l
.starts_with("thread 'main' panicked at")), Some(true));
21 assert_eq
!(it
.next(), None
);
25 let args
: Vec
<String
> = std
::env
::args().collect();
26 if args
.len() > 1 && args
[1] == "run_test" {
27 let _
= std
::thread
::spawn(|| {
33 let test
= std
::process
::Command
::new(&args
[0]).arg("run_test")
34 .env_remove("RUST_BACKTRACE")
37 check_for_no_backtrace(test
);
38 let test
= std
::process
::Command
::new(&args
[0]).arg("run_test")
39 .env("RUST_BACKTRACE","0")
42 check_for_no_backtrace(test
);