summaryrefslogtreecommitdiffstats
path: root/src/test/ui/process
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:12:43 +0000
commitcf94bdc0742c13e2a0cac864c478b8626b266e1b (patch)
tree044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /src/test/ui/process
parentAdding debian version 1.65.0+dfsg1-2. (diff)
downloadrustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz
rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/process')
-rw-r--r--src/test/ui/process/process-panic-after-fork.rs45
-rw-r--r--src/test/ui/process/process-spawn-nonexistent.rs1
-rw-r--r--src/test/ui/process/process-spawn-with-unicode-params.rs1
-rw-r--r--src/test/ui/process/signal-exit-status.rs1
4 files changed, 46 insertions, 2 deletions
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<A:GlobalAlloc> GlobalAlloc for PidChecking<A> {
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-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;