()
| 1547 | |
| 1548 | assert!(!uart.contains("PANIC!"), "kernel panicked; uart={uart:?}"); |
| 1549 | assert!( |
| 1550 | !uart.contains("unhandled exception"), |
| 1551 | "the HLL-0 target faulted; uart={uart:?}" |
| 1552 | ); |
| 1553 | assert!( |
| 1554 | uart.contains("as: wrote /hello.elf"), |
| 1555 | "assembler did not report success; uart={uart:?}" |
| 1556 | ); |
| 1557 | // Both the host-compiled source and the hand-written target must print the |
| 1558 | // marker and exit 36, so each appears twice. |
| 1559 | assert!( |
| 1560 | uart.matches("HLL0").count() >= 2, |
| 1561 | "source and target did not both print the marker; uart={uart:?}" |
| 1562 | ); |
| 1563 | assert!( |
| 1564 | uart.matches("[exit 36]").count() >= 2, |
| 1565 | "source and target did not both exit 36; uart={uart:?}" |
| 1566 | ); |
| 1567 | assert!( |
| 1568 | matches!(outcome, StepOutcome::Halted(0)), |
| 1569 | "shell did not survive the runs and exit cleanly; outcome={outcome:?} uart={uart:?}" |
| 1570 | ); |
| 1571 | } |
| 1572 | |
| 1573 | // `cc.hll` is built into /bin/cc.elf, so it must host-compile. Fast guard for |
| 1574 | // HLL errors without booting the kernel. |
| 1575 | #[test] |
| 1576 | fn cc_host_compiles() { |
| 1577 | let out = compile_hosted_program("cc"); |
| 1578 | assert!( |
| 1579 | !out.to_flat_binary().is_empty(), |
| 1580 | "cc.hll produced an empty binary" |
| 1581 | ); |
| 1582 | } |
| 1583 | |
| 1584 | // Separate compilation entirely in-VM: a.s calls an external `get_val` (CALL_PLT) |
| 1585 | // and b.s loads its own `.data` via `la` (PCREL_HI20), so `[exit 42]` covers both. |
| 1586 | #[test] |
| 1587 | fn kernel_ld_links_objects_and_runs() { |
| 1588 | let a_s = b"\ |
| 1589 | .globl _start |
| 1590 | .text |
| 1591 | _start: |
| 1592 | call get_val |
| 1593 | li a7, 93 |
| 1594 | ecall |
| 1595 | "; |
| 1596 | let b_s = b"\ |
nothing calls this directly
no test coverage detected