Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions example-kernels/runner-doctest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ extern crate rlibc;
/// extern "C" fn start() {
/// assert_eq!(add(1, 2), 3);
/// unsafe { exit_qemu(ExitCode::Success); }
/// // Spin until QEMU shuts down to avoid overwriting the exit code (TCG race on ARM64).
/// loop {}
/// }
/// ```
pub fn add(a: u32, b: u32) -> u32 {
Expand All @@ -32,6 +34,8 @@ pub fn add(a: u32, b: u32) -> u32 {
/// extern "C" fn start() {
/// assert_eq!(mul(2, 3), 6);
/// unsafe { exit_qemu(ExitCode::Success); }
/// // Spin until QEMU shuts down to avoid overwriting the exit code (TCG race on ARM64).
/// loop {}
/// }
/// ```
pub fn mul(a: u32, b: u32) -> u32 {
Expand All @@ -47,6 +51,9 @@ fn test_runner(tests: &[&dyn Fn()]) {
unsafe {
exit_qemu(ExitCode::Success);
}
// Keep spinning so that the fallthrough `exit_qemu(Failed)` in `_start`
// cannot overwrite the exit code before QEMU shuts down (TCG race on ARM64).
loop {}
}

pub enum ExitCode {
Expand Down
3 changes: 3 additions & 0 deletions example-kernels/runner-fail-reboot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ pub fn test_runner(tests: &[&dyn Fn()]) {
unsafe {
exit_qemu(ExitCode::Success);
}
// Keep spinning so that the fallthrough `exit_qemu(Failed)` in `_start`
// cannot overwrite the exit code before QEMU shuts down (TCG race on ARM64).
loop {}
}

#[test_case]
Expand Down
3 changes: 3 additions & 0 deletions example-kernels/runner-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ pub fn test_runner(tests: &[&dyn Fn()]) {
}

unsafe { exit_qemu(ExitCode::Success); }
// Keep spinning so that the fallthrough `exit_qemu(Failed)` in `_start`
// cannot overwrite the exit code before QEMU shuts down (TCG race on ARM64).
loop {}
}

#[test_case]
Expand Down
Loading