diff --git a/crates/stela-runtime/src/platform/pc/device_starts.rs b/crates/stela-runtime/src/platform/pc/device_starts.rs index ceb487f68a..2dee24e6bb 100644 --- a/crates/stela-runtime/src/platform/pc/device_starts.rs +++ b/crates/stela-runtime/src/platform/pc/device_starts.rs @@ -213,6 +213,11 @@ fn boot_skips(boot: &str) -> Option { let mut skips = Skips::default(); let mut pending = None; for line in boot.lines() { + // The log stamps each line it keeps with `[ 12.345] ` (`output::stamp`). + let line = line + .strip_prefix('[') + .and_then(|stamped| stamped.split_once("] ")) + .map_or(line, |(_, rest)| rest); if let Some(function) = Function::parse(line, START) { pending = Some(function); } else if line.starts_with(STARTED) { @@ -354,6 +359,26 @@ mod tests { assert!(read(text.as_bytes()).holds(&lan)); } + #[test] + fn stamped_lines_as_the_log_keeps_them_are_read() { + // A v0.3.1 boot that stalled in its RTL8126's start, as its log has it. + let text = "=== STELA BOOT 1 ===\n\ + [ 46.686] HOST DEVICE START pci=0000:0a:0d.0 id=1022:43f5\n\ + [ 46.693] HOST DEVICE PCI 0000:0d:00.0 start\n\ + [ 46.693] HOST DEVICE START pci=0000:0d:00.0 id=10ec:8126\n"; + let lan = Function { + address: Address::parse("0000:0d:00.0").unwrap(), + vendor: 0x10ec, + device: 0x8126, + }; + assert!(settled(text.as_bytes())); + let skips = read(text.as_bytes()); + assert!(skips.holds(&lan)); + assert_eq!(skips.iter().count(), 1); + let finished = format!("{text}[ 47.000] {STARTED}\n"); + assert!(read(finished.as_bytes()).is_empty()); + } + #[test] fn a_log_without_markers_reads_as_no_stall() { // As Stela 0.3.0 wrote it: start lines, no markers.