diff options
| author | bors <bors@rust-lang.org> | 2018-07-30 04:34:19 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-07-30 04:34:19 +0000 |
| commit | a3f519df09bf40d09c1a111599b8f115f11fbb49 (patch) | |
| tree | c58d1dd9f96ee5675660cb29da0bbd44f6b7f3b0 /src | |
| parent | b12235db096ab24a31e6e894757abfe8b018d44a (diff) | |
| parent | c7f01aa175c97c1103f45f73aad8b679edc3d045 (diff) | |
| download | rust-a3f519df09bf40d09c1a111599b8f115f11fbb49.tar.gz rust-a3f519df09bf40d09c1a111599b8f115f11fbb49.zip | |
Auto merge of #52823 - RalfJung:test, r=eddyb
invalid_const_promotion: check if we get the right signal r? @eddyb
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-pass/invalid_const_promotion.rs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/test/run-pass/invalid_const_promotion.rs b/src/test/run-pass/invalid_const_promotion.rs index 29a4b921992..53cb4c4b009 100644 --- a/src/test/run-pass/invalid_const_promotion.rs +++ b/src/test/run-pass/invalid_const_promotion.rs @@ -11,18 +11,37 @@ // ignore-wasm32 // ignore-emscripten -#![feature(const_fn)] +#![feature(const_fn, libc)] #![allow(const_err)] +extern crate libc; + use std::env; use std::process::{Command, Stdio}; +// this will panic in debug mode const fn bar() -> usize { 0 - 1 } fn foo() { let _: &'static _ = &bar(); } +#[cfg(unix)] +fn check_status(status: std::process::ExitStatus) +{ + use libc; + use std::os::unix::process::ExitStatusExt; + + assert!(status.signal() == Some(libc::SIGILL) + || status.signal() == Some(libc::SIGABRT)); +} + +#[cfg(not(unix))] +fn check_status(status: std::process::ExitStatus) +{ + assert!(!status.success()); +} + fn main() { let args: Vec<String> = env::args().collect(); if args.len() > 1 && args[1] == "test" { @@ -34,5 +53,5 @@ fn main() { .stdout(Stdio::piped()) .stdin(Stdio::piped()) .arg("test").output().unwrap(); - assert!(!p.status.success()); + check_status(p.status); } |
