@@ -89,29 +89,29 @@ fn expect_aborted(status: ExitStatus) {
8989 assert ! ( signal == libc:: SIGSEGV ) ;
9090
9191 // Additional checks performed:
92- // 1. Crash is from same executable (path) as we are (must be because of fork):
92+ // 1. Find last tombstone (similar to coredump but in text format) from the
93+ // same executable (path) as we are (must be because of usage of fork):
9394 // This ensures that we look into the correct tombstone.
9495 // 2. Cause of crash is a SIGSEGV with address 0xdeadbaad.
9596 // 3. libc::abort call is in one of top two functions on callstack.
9697 // The last two steps distinguish between a normal SIGSEGV and one caused
9798 // by libc::abort.
9899
99- let tombstone_name = ( 0 ..100 )
100+ let this_exe = std:: env:: current_exe ( ) . unwrap ( ) . into_os_string ( ) . into_string ( ) . unwrap ( ) ;
101+ let exe_string = format ! ( ">>> {this_exe} <<<" ) ;
102+ let tombstone = ( 0 ..100 )
100103 . map ( |n| format ! ( "/data/tombstones/tombstone_{n:02}" ) )
101104 . filter ( |f| std:: path:: Path :: new ( & f) . exists ( ) )
105+ . map ( |f| std:: fs:: read_to_string ( & f) . expect ( "Cannot read tombstone file" ) )
106+ . filter ( |f| f. contains ( & exe_string) )
102107 . last ( )
103108 . expect ( "no tombstone found" ) ;
104109
105- let tombstone =
106- std:: fs:: read_to_string ( & tombstone_name) . expect ( "Cannot read tombstone file" ) ;
107- println ! ( "Content of {tombstone_name}:\n {tombstone}" ) ;
110+ println ! ( "Content of tombstone:\n {tombstone}" ) ;
108111
109- // If the next assert fails sporadically we might have an issue with parallel crashing apps
110- assert ! ( tombstone
111- . contains( & std:: env:: current_exe( ) . unwrap( ) . into_os_string( ) . into_string( ) . unwrap( ) ) ) ;
112- assert ! ( tombstone. contains(
113- "signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad"
114- ) ) ;
112+ assert ! (
113+ tombstone. contains( "signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad" )
114+ ) ;
115115 let abort_on_top = tombstone
116116 . lines ( )
117117 . skip_while ( |l| !l. contains ( "backtrace:" ) )
0 commit comments