Skip to content

Commit cbaa831

Browse files
committed
Add match arm for Fuchsia status code upon an abort in a test
This change adds ZX_TASK_RETCODE_EXCEPTION_KILL as an expected status code upon an abort in a test on Fuchsia. Tests fixes rust-lang#127539
1 parent a778c83 commit cbaa831

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/src/test_result.rs

+11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ pub const TR_OK: i32 = 50;
2121
#[cfg(windows)]
2222
const STATUS_ABORTED: i32 = 0xC0000409u32 as i32;
2323

24+
// On Zircon (the Fuchsia kernel), an abort from userspace calls the
25+
// LLVM implementation of __builtin_trap(), e.g., ud2 on x86, which
26+
// raises a kernel exception. If a userspace process does not
27+
// otherwise arrange exception handling, the kernel kills the process
28+
// with this return code.
29+
#[cfg(target_os = "fuchsia")]
30+
const ZX_TASK_RETCODE_EXCEPTION_KILL: i32 = -1028;
31+
2432
#[derive(Debug, Clone, PartialEq)]
2533
pub enum TestResult {
2634
TrOk,
@@ -105,6 +113,9 @@ pub fn get_result_from_exit_code(
105113
}
106114
None => unreachable!("status.code() returned None but status.signal() was None"),
107115
},
116+
// Upon an abort, Fuchsia returns the status code ZX_TASK_RETCODE_EXCEPTION_KILL.
117+
#[cfg(target_os = "fuchsia")]
118+
Some(ZX_TASK_RETCODE_EXCEPTION_KILL) => TestResult::TrFailed,
108119
#[cfg(not(unix))]
109120
None => TestResult::TrFailedMsg(format!("unknown return code")),
110121
#[cfg(any(windows, unix))]

0 commit comments

Comments
 (0)