File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -19,22 +19,43 @@ extern "C" fn panic_in_ffi() {
1919 panic ! ( "Test" ) ;
2020}
2121
22+ #[ unwind( aborts) ]
23+ extern "Rust" fn panic_in_rust_abi ( ) {
24+ panic ! ( "TestRust" ) ;
25+ }
26+
2227fn test ( ) {
2328 let _ = panic:: catch_unwind ( || { panic_in_ffi ( ) ; } ) ;
2429 // The process should have aborted by now.
2530 io:: stdout ( ) . write ( b"This should never be printed.\n " ) ;
2631 let _ = io:: stdout ( ) . flush ( ) ;
2732}
2833
34+ fn testrust ( ) {
35+ let _ = panic:: catch_unwind ( || { panic_in_rust_abi ( ) ; } ) ;
36+ // The process should have aborted by now.
37+ io:: stdout ( ) . write ( b"This should never be printed.\n " ) ;
38+ let _ = io:: stdout ( ) . flush ( ) ;
39+ }
40+
2941fn main ( ) {
3042 let args: Vec < String > = env:: args ( ) . collect ( ) ;
3143 if args. len ( ) > 1 && args[ 1 ] == "test" {
3244 return test ( ) ;
3345 }
46+ if args. len ( ) > 1 && args[ 1 ] == "testrust" {
47+ return testrust ( ) ;
48+ }
3449
3550 let mut p = Command :: new ( & args[ 0 ] )
3651 . stdout ( Stdio :: piped ( ) )
3752 . stdin ( Stdio :: piped ( ) )
3853 . arg ( "test" ) . spawn ( ) . unwrap ( ) ;
3954 assert ! ( !p. wait( ) . unwrap( ) . success( ) ) ;
55+
56+ let mut p = Command :: new ( & args[ 0 ] )
57+ . stdout ( Stdio :: piped ( ) )
58+ . stdin ( Stdio :: piped ( ) )
59+ . arg ( "testrust" ) . spawn ( ) . unwrap ( ) ;
60+ assert ! ( !p. wait( ) . unwrap( ) . success( ) ) ;
4061}
You can’t perform that action at this time.
0 commit comments