mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
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:
commit
3d18c4d62d
@ -84,10 +84,15 @@ fn expect_aborted(status: ExitStatus) {
|
|||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
{
|
{
|
||||||
// Android signals an abort() call with SIGSEGV at address 0xdeadbaad
|
assert!(signal == libc::SIGABRT || signal == libc::SIGSEGV);
|
||||||
// See e.g. https://groups.google.com/g/android-ndk/c/laW1CJc7Icc
|
|
||||||
assert!(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:
|
// Additional checks performed:
|
||||||
// 1. Find last tombstone (similar to coredump but in text format) from the
|
// 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):
|
// 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}");
|
println!("Content of tombstone:\n{tombstone}");
|
||||||
|
|
||||||
assert!(
|
assert!(tombstone
|
||||||
tombstone.contains("signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad")
|
.contains("signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadbaad"));
|
||||||
);
|
|
||||||
let abort_on_top = tombstone
|
let abort_on_top = tombstone
|
||||||
.lines()
|
.lines()
|
||||||
.skip_while(|l| !l.contains("backtrace:"))
|
.skip_while(|l| !l.contains("backtrace:"))
|
||||||
@ -122,6 +126,7 @@ fn expect_aborted(status: ExitStatus) {
|
|||||||
assert!(abort_on_top);
|
assert!(abort_on_top);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
ALLOCATOR.engage();
|
ALLOCATOR.engage();
|
||||||
|
Loading…
Reference in New Issue
Block a user