MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / assert_user_exit_ok

Function assert_user_exit_ok

tests/integration/kernel_integration.rs:136–154  ·  view source on GitHub ↗

A hosted user program injected as pid 1 must spawn and exit with code 0.

(uart: &str, outcome: &StepOutcome, label: &str)

Source from the content-addressed store, hash-verified

134 uart.contains("[ PROC ] pid 1 ready"),
135 "{label}: user process was not spawned; uart={uart:?}"
136 );
137 // A pid-1 program exiting cleanly calls kshutdown(0), halting the VM with 0.
138 assert!(
139 matches!(outcome, StepOutcome::Halted(0)),
140 "{label}: user process did not exit cleanly with code 0; got {outcome:?}, uart={uart:?}"
141 );
142}
143
144// Compile a hosted program and inject it as pid 1 (no FS image), then assert a
145// clean spawn-and-exit.
146fn run_example_in_kernel(user_src: &str, label: &str) {
147 let user = compile_hosted(user_src);
148 let (_, outcome, uart) = boot_kernel(cached_kernel(), Some(&user), None, "", 10_000_000);
149 assert_user_exit_ok(&uart, &outcome, label);
150}
151
152fn run_example_manifest_in_kernel(name: &str) {
153 let manifest_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
154 .join("programs/example")
155 .join(name)
156 .join(format!("{name}.build"));
157 let manifest = BuildManifest::from_file(&manifest_path)

Callers 5

run_example_in_kernelFunction · 0.85
kernel_fs_full_lifecycleFunction · 0.85

Calls

no outgoing calls

Tested by 3

kernel_fs_full_lifecycleFunction · 0.68