mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
cf6d6050f7
* The WASI targets deal with the `main` symbol a bit differently than native so some `codegen` and `assembly` tests have been ignored. * All `ignore-emscripten` directives have been updated to `ignore-wasm32` to be more clear that all wasm targets are ignored and it's not just Emscripten. * Most `ignore-wasm32-bare` directives are now gone. * Some ignore directives for wasm were switched to `needs-unwind` instead. * Many `ignore-wasm32*` directives are removed as the tests work with WASI as opposed to `wasm32-unknown-unknown`.
41 lines
1.6 KiB
Rust
41 lines
1.6 KiB
Rust
//@ run-pass
|
|
//@ ignore-wasm32 no processes
|
|
//@ ignore-sgx no processes
|
|
//@ needs-unwind
|
|
|
|
fn check_for_no_backtrace(test: std::process::Output) {
|
|
assert!(!test.status.success());
|
|
let err = String::from_utf8_lossy(&test.stderr);
|
|
let mut it = err.lines();
|
|
|
|
assert_eq!(it.next().map(|l| l.starts_with("thread '<unnamed>' panicked")), Some(true));
|
|
assert_eq!(it.next().is_some(), true);
|
|
assert_eq!(it.next(), Some("note: run with `RUST_BACKTRACE=1` \
|
|
environment variable to display a backtrace"));
|
|
assert_eq!(it.next().map(|l| l.starts_with("thread 'main' panicked at")), Some(true));
|
|
assert_eq!(it.next().is_some(), true);
|
|
assert_eq!(it.next(), None);
|
|
}
|
|
|
|
fn main() {
|
|
let args: Vec<String> = std::env::args().collect();
|
|
if args.len() > 1 && args[1] == "run_test" {
|
|
let _ = std::thread::spawn(|| {
|
|
panic!();
|
|
}).join();
|
|
|
|
panic!();
|
|
} else {
|
|
let test = std::process::Command::new(&args[0]).arg("run_test")
|
|
.env_remove("RUST_BACKTRACE")
|
|
.output()
|
|
.unwrap();
|
|
check_for_no_backtrace(test);
|
|
let test = std::process::Command::new(&args[0]).arg("run_test")
|
|
.env("RUST_BACKTRACE","0")
|
|
.output()
|
|
.unwrap();
|
|
check_for_no_backtrace(test);
|
|
}
|
|
}
|