]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / test / run-pass / panic-runtime / abort-link-to-unwinding-crates.rs
CommitLineData
a7813a04
XL
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.
4//
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.
10
11// compile-flags:-C panic=abort
12// aux-build:exit-success-if-unwind.rs
13// no-prefer-dynamic
abe05a73 14// ignore-emscripten no processes
a7813a04
XL
15
16extern crate exit_success_if_unwind;
17
18use std::process::Command;
19use std::env;
20
21fn main() {
22 let mut args = env::args_os();
23 let me = args.next().unwrap();
24
25 if let Some(s) = args.next() {
26 if &*s == "foo" {
27 exit_success_if_unwind::bar(do_panic);
28 }
29 }
7cac9316
XL
30
31 let mut cmd = Command::new(env::args_os().next().unwrap());
32 cmd.arg("foo");
33
34
35 // ARMv6 hanges while printing the backtrace, see #41004
36 if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") {
37 cmd.env("RUST_BACKTRACE", "0");
38 }
39
40 let s = cmd.status();
a7813a04
XL
41 assert!(s.unwrap().code() != Some(0));
42}
43
44fn do_panic() {
45 panic!("try to catch me");
46}