File tree 1 file changed +21
-0
lines changed
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() {
19
19
panic ! ( "Test" ) ;
20
20
}
21
21
22
+ #[ unwind( aborts) ]
23
+ extern "Rust" fn panic_in_rust_abi ( ) {
24
+ panic ! ( "TestRust" ) ;
25
+ }
26
+
22
27
fn test ( ) {
23
28
let _ = panic:: catch_unwind ( || { panic_in_ffi ( ) ; } ) ;
24
29
// The process should have aborted by now.
25
30
io:: stdout ( ) . write ( b"This should never be printed.\n " ) ;
26
31
let _ = io:: stdout ( ) . flush ( ) ;
27
32
}
28
33
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
+
29
41
fn main ( ) {
30
42
let args: Vec < String > = env:: args ( ) . collect ( ) ;
31
43
if args. len ( ) > 1 && args[ 1 ] == "test" {
32
44
return test ( ) ;
33
45
}
46
+ if args. len ( ) > 1 && args[ 1 ] == "testrust" {
47
+ return testrust ( ) ;
48
+ }
34
49
35
50
let mut p = Command :: new ( & args[ 0 ] )
36
51
. stdout ( Stdio :: piped ( ) )
37
52
. stdin ( Stdio :: piped ( ) )
38
53
. arg ( "test" ) . spawn ( ) . unwrap ( ) ;
39
54
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( ) ) ;
40
61
}
You can’t perform that action at this time.
0 commit comments