diff --git a/src/test/ui/process/process-panic-after-fork.rs b/src/test/ui/process/process-panic-after-fork.rs index 9b0f9f82f8f6..43c23b49737d 100644 --- a/src/test/ui/process/process-panic-after-fork.rs +++ b/src/test/ui/process/process-panic-after-fork.rs @@ -78,7 +78,29 @@ unsafe impl GlobalAlloc for PidChecking { fn expect_aborted(status: ExitStatus) { dbg!(status); let signal = status.signal().expect("expected child process to die of signal"); + + #[cfg(not(target_os = "android"))] assert!(signal == libc::SIGABRT || signal == libc::SIGILL || signal == libc::SIGTRAP); + + #[cfg(target_os = "android")] + { + // Android signals an abort() call with SIGSEGV at address 0xdeadbaad + // See e.g. https://groups.google.com/g/android-ndk/c/laW1CJc7Icc + assert!(signal == libc::SIGSEGV); + // Check if the crash occured at addres deadbaad to ensure it is not some undefined + // behavior but actually an abort + let tombstone = (0..100) + .map(|n| format!("/data/tombstones/tombstone_{n:02}")) + .filter(|f| std::path::Path::new(&f).exists()) + .last() + .expect("no tombstone found"); + let tombstone = + std::fs::read_to_string(&tombstone).expect("Cannot read tombstone file"); + // If the next assert fails sporadically we might have an issue with parallel crashing apps + assert!(tombstone + .contains(&std::env::current_exe().unwrap().into_os_string().into_string().unwrap())); + assert!(tombstone.contains("signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad")); + } } fn main() {