From 94a0819fe3a0d679c3042a77bfe6a2afc505daea Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:28 +0200 Subject: Adding upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/process/core-run-destroy.rs | 1 + src/test/ui/process/process-envs.rs | 1 + src/test/ui/process/process-panic-after-fork.rs | 45 +++++++++++++++++++++- src/test/ui/process/process-remove-from-env.rs | 1 + src/test/ui/process/process-sigpipe.rs | 1 + src/test/ui/process/process-spawn-nonexistent.rs | 1 + .../process/process-spawn-with-unicode-params.rs | 1 + src/test/ui/process/signal-exit-status.rs | 1 + 8 files changed, 50 insertions(+), 2 deletions(-) (limited to 'src/test/ui/process') diff --git a/src/test/ui/process/core-run-destroy.rs b/src/test/ui/process/core-run-destroy.rs index 5fd418e6c..d0e97bf01 100644 --- a/src/test/ui/process/core-run-destroy.rs +++ b/src/test/ui/process/core-run-destroy.rs @@ -8,6 +8,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'cat' and 'sleep' +// ignore-fuchsia no 'cat' // N.B., these tests kill child processes. Valgrind sees these children as leaking // memory, which makes for some *confusing* logs. That's why these are here diff --git a/src/test/ui/process/process-envs.rs b/src/test/ui/process/process-envs.rs index 8fc99b23f..f3a469791 100644 --- a/src/test/ui/process/process-envs.rs +++ b/src/test/ui/process/process-envs.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'env' +// ignore-fuchsia no 'env' use std::process::Command; use std::env; diff --git a/src/test/ui/process/process-panic-after-fork.rs b/src/test/ui/process/process-panic-after-fork.rs index 1ccf6bb05..6d4d24922 100644 --- a/src/test/ui/process/process-panic-after-fork.rs +++ b/src/test/ui/process/process-panic-after-fork.rs @@ -5,9 +5,8 @@ // ignore-sgx no libc // ignore-emscripten no processes // ignore-sgx no processes -// ignore-android: FIXME(#85261) +// ignore-fuchsia no fork -#![feature(bench_black_box)] #![feature(rustc_private)] #![feature(never_type)] #![feature(panic_always_abort)] @@ -79,7 +78,49 @@ 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); + + // 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): + // This ensures that we look into the correct tombstone. + // 2. Cause of crash is a SIGSEGV with address 0xdeadbaad. + // 3. libc::abort call is in one of top two functions on callstack. + // The last two steps distinguish between a normal SIGSEGV and one caused + // by libc::abort. + + let this_exe = std::env::current_exe().unwrap().into_os_string().into_string().unwrap(); + let exe_string = format!(">>> {this_exe} <<<"); + let tombstone = (0..100) + .map(|n| format!("/data/tombstones/tombstone_{n:02}")) + .filter(|f| std::path::Path::new(&f).exists()) + .map(|f| std::fs::read_to_string(&f).expect("Cannot read tombstone file")) + .filter(|f| f.contains(&exe_string)) + .last() + .expect("no tombstone found"); + + println!("Content of tombstone:\n{tombstone}"); + + 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:")) + .skip(1) + .take_while(|l| l.starts_with(" #")) + .take(2) + .any(|f| f.contains("/system/lib/libc.so (abort")); + assert!(abort_on_top); + } } fn main() { diff --git a/src/test/ui/process/process-remove-from-env.rs b/src/test/ui/process/process-remove-from-env.rs index af4e49dfd..ad027d685 100644 --- a/src/test/ui/process/process-remove-from-env.rs +++ b/src/test/ui/process/process-remove-from-env.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-vxworks no 'env' +// ignore-fuchsia no 'env' use std::process::Command; use std::env; diff --git a/src/test/ui/process/process-sigpipe.rs b/src/test/ui/process/process-sigpipe.rs index ecf5e93c9..107eba45d 100644 --- a/src/test/ui/process/process-sigpipe.rs +++ b/src/test/ui/process/process-sigpipe.rs @@ -14,6 +14,7 @@ // ignore-emscripten no threads support // ignore-vxworks no 'sh' +// ignore-fuchsia no 'sh' use std::process; use std::thread; diff --git a/src/test/ui/process/process-spawn-nonexistent.rs b/src/test/ui/process/process-spawn-nonexistent.rs index a51372263..9dd608986 100644 --- a/src/test/ui/process/process-spawn-nonexistent.rs +++ b/src/test/ui/process/process-spawn-nonexistent.rs @@ -1,6 +1,7 @@ // run-pass // ignore-emscripten no processes // ignore-sgx no processes +// ignore-fuchsia ErrorKind not translated use std::io::ErrorKind; use std::process::Command; diff --git a/src/test/ui/process/process-spawn-with-unicode-params.rs b/src/test/ui/process/process-spawn-with-unicode-params.rs index 6e9229b62..16dba6292 100644 --- a/src/test/ui/process/process-spawn-with-unicode-params.rs +++ b/src/test/ui/process/process-spawn-with-unicode-params.rs @@ -9,6 +9,7 @@ // ignore-emscripten no processes // ignore-sgx no processes +// ignore-fuchsia Filesystem manipulation privileged use std::io::prelude::*; use std::io; diff --git a/src/test/ui/process/signal-exit-status.rs b/src/test/ui/process/signal-exit-status.rs index 0963dcc80..9519ed7b4 100644 --- a/src/test/ui/process/signal-exit-status.rs +++ b/src/test/ui/process/signal-exit-status.rs @@ -2,6 +2,7 @@ // ignore-emscripten no processes // ignore-sgx no processes // ignore-windows +// ignore-fuchsia code returned as ZX_TASK_RETCODE_EXCEPTION_KILL, FIXME (#58590) use std::env; use std::process::Command; -- cgit v1.2.3