File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,29 @@ unsafe impl<A:GlobalAlloc> GlobalAlloc for PidChecking<A> {
78
78
fn expect_aborted ( status : ExitStatus ) {
79
79
dbg ! ( status) ;
80
80
let signal = status. signal ( ) . expect ( "expected child process to die of signal" ) ;
81
+
82
+ #[ cfg( not( target_os = "android" ) ) ]
81
83
assert ! ( signal == libc:: SIGABRT || signal == libc:: SIGILL || signal == libc:: SIGTRAP ) ;
84
+
85
+ #[ cfg( target_os = "android" ) ]
86
+ {
87
+ // Android signals an abort() call with SIGSEGV at address 0xdeadbaad
88
+ // See e.g. https://groups.google.com/g/android-ndk/c/laW1CJc7Icc
89
+ assert ! ( signal == libc:: SIGSEGV ) ;
90
+ // Check if the crash occured at addres deadbaad to ensure it is not some undefined
91
+ // behavior but actually an abort
92
+ let tombstone = ( 0 ..100 )
93
+ . map ( |n| format ! ( "/data/tombstones/tombstone_{n:02}" ) )
94
+ . filter ( |f| std:: path:: Path :: new ( & f) . exists ( ) )
95
+ . last ( )
96
+ . expect ( "no tombstone found" ) ;
97
+ let tombstone =
98
+ std:: fs:: read_to_string ( & tombstone) . expect ( "Cannot read tombstone file" ) ;
99
+ // If the next assert fails sporadically we might have an issue with parallel crashing apps
100
+ assert ! ( tombstone
101
+ . contains( & std:: env:: current_exe( ) . unwrap( ) . into_os_string( ) . into_string( ) . unwrap( ) ) ) ;
102
+ assert ! ( tombstone. contains( "signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad" ) ) ;
103
+ }
82
104
}
83
105
84
106
fn main ( ) {
You can’t perform that action at this time.
0 commit comments