()
| 241 | // All of these formerly recompiled the kernel and asserted on different parts of |
| 242 | // the same boot. One boot now covers the whole sequence. |
| 243 | |
| 244 | #[test] |
| 245 | fn kernel_boot_full_sequence() { |
| 246 | let user = compile_hosted(user::USER_HELLO); |
| 247 | let (_, outcome, uart) = boot_kernel(cached_kernel(), Some(&user), None, "", 10_000_000); |
| 248 | |
| 249 | match outcome { |
| 250 | RunOutcome::TimedOut => {} // idle loop, expected |
| 251 | RunOutcome::Halted(c) => panic!("unexpected halt with code {c}; uart={uart:?}"), |
| 252 | RunOutcome::Fault(error) => panic!("VM fault: {error}; uart={uart:?}"), |
| 253 | } |
| 254 | |
| 255 | // Banner and init order: console -> device tree -> memory diagnostics. |
| 256 | assert!( |
| 257 | uart.contains("[ OK ] kernel starting\n"), |
| 258 | "expected boot banner; uart={uart:?}" |
| 259 | ); |
| 260 | let console_pos = uart |
| 261 | .find("[ OK ] console online\n") |
| 262 | .expect("console online missing"); |
| 263 | let dt_pos = uart |
| 264 | .find("[ WARN ] device tree:") |
| 265 | .expect("device tree warn missing"); |
| 266 | let mem_pos = uart |
| 267 | .find("[ OK ] running memory diagnostics...\n") |
| 268 | .expect("memory diagnostics missing"); |
| 269 | assert!( |
| 270 | console_pos < dt_pos && dt_pos < mem_pos, |
| 271 | "init order wrong: console={console_pos} dt={dt_pos} mem={mem_pos}" |
| 272 | ); |
| 273 | |
| 274 | // Self-tests and arming. |
| 275 | assert!( |
| 276 | uart.contains("[ OK ] memory self-test passed\n"), |
| 277 | "expected memory self-test to pass; uart={uart:?}" |
| 278 | ); |
| 279 | assert!( |
| 280 | !uart.contains("memory self-test failed"), |
| 281 | "memory self-test must not fail; uart={uart:?}" |
| 282 | ); |
| 283 | assert!( |
| 284 | uart.contains("[ OK ] heap ready\n"), |
| 285 | "expected heap smoke-test; uart={uart:?}" |
| 286 | ); |
| 287 | assert!( |
| 288 | uart.contains("[ OK ] timer armed\n"), |
| 289 | "expected timer armed; uart={uart:?}" |
| 290 | ); |
| 291 | assert!( |
| 292 | uart.contains("[ OK ] boot complete\n"), |
| 293 | "expected boot complete; uart={uart:?}" |
| 294 | ); |
| 295 | |
| 296 | // User process spawns and greets. |
| 297 | assert!( |
| 298 | uart.contains("[ PROC ] pid 1 ready"), |
| 299 | "expected user process spawn; uart={uart:?}" |
| 300 | ); |
nothing calls this directly
no test coverage detected