File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1111// ignore-wasm32
1212// ignore-emscripten
1313
14- #![ feature( const_fn) ]
14+ #![ feature( const_fn, libc ) ]
1515#![ allow( const_err) ]
1616
17+ extern crate libc;
18+
1719use std:: env;
1820use std:: process:: { Command , Stdio } ;
1921
22+ // this will panic in debug mode
2023const fn bar ( ) -> usize { 0 - 1 }
2124
2225fn foo ( ) {
2326 let _: & ' static _ = & bar ( ) ;
2427}
2528
29+ #[ cfg( unix) ]
30+ fn check_status ( status : std:: process:: ExitStatus )
31+ {
32+ use libc;
33+ use std:: os:: unix:: process:: ExitStatusExt ;
34+
35+ assert ! ( status. signal( ) == Some ( libc:: SIGILL )
36+ || status. signal( ) == Some ( libc:: SIGABRT ) ) ;
37+ }
38+
39+ #[ cfg( not( unix) ) ]
40+ fn check_status ( status : std:: process:: ExitStatus )
41+ {
42+ assert ! ( !status. success( ) ) ;
43+ }
44+
2645fn main ( ) {
2746 let args: Vec < String > = env:: args ( ) . collect ( ) ;
2847 if args. len ( ) > 1 && args[ 1 ] == "test" {
@@ -34,5 +53,5 @@ fn main() {
3453 . stdout ( Stdio :: piped ( ) )
3554 . stdin ( Stdio :: piped ( ) )
3655 . arg ( "test" ) . output ( ) . unwrap ( ) ;
37- assert ! ( ! p. status. success ( ) ) ;
56+ check_status ( p. status ) ;
3857}
You can’t perform that action at this time.
0 commit comments