Rollup merge of #105517 - pcc:process-panic-after-fork, r=davidtwco

Fix process-panic-after-fork.rs to pass on newer versions of Android.

The test process-panic-after-fork.rs was checking that abort() resulted in SIGSEGV on Android. This non-standard behavior was fixed back in 2013, so let's fix the test to also accept the standard behavior on Android.
This commit is contained in:
Matthias Krüger 2023-01-07 20:43:20 +01:00 committed by GitHub
commit 3d18c4d62d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,10 +84,15 @@ fn expect_aborted(status: ExitStatus) {
#[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);
assert!(signal == libc::SIGABRT || signal == libc::SIGSEGV);
if signal == libc::SIGSEGV {
// Pre-KitKat versions of Android signal an abort() with SIGSEGV at address 0xdeadbaad
// See e.g. https://groups.google.com/g/android-ndk/c/laW1CJc7Icc
//
// This behavior was changed in KitKat to send a standard SIGABRT signal.
// See: https://r.android.com/60341
//
// Additional checks performed:
// 1. Find last tombstone (similar to coredump but in text format) from the
// same executable (path) as we are (must be because of usage of fork):
@ -109,9 +114,8 @@ fn expect_aborted(status: ExitStatus) {
println!("Content of tombstone:\n{tombstone}");
assert!(
tombstone.contains("signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad")
);
assert!(tombstone
.contains("signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad"));
let abort_on_top = tombstone
.lines()
.skip_while(|l| !l.contains("backtrace:"))
@ -122,6 +126,7 @@ fn expect_aborted(status: ExitStatus) {
assert!(abort_on_top);
}
}
}
fn main() {
ALLOCATOR.engage();