()
| 1597 | "; |
| 1598 | |
| 1599 | let (outcome, uart) = run_tool_session( |
| 1600 | &["as", "ld"], |
| 1601 | &[("/a.s", a_s), ("/b.s", b_s)], |
| 1602 | "as /a.s /a.o\nas /b.s /b.o\nld /a.o /b.o /prog\nrun /prog\nexit\n", |
| 1603 | 300_000_000, |
| 1604 | ); |
| 1605 | |
| 1606 | assert!(!uart.contains("PANIC!"), "kernel panicked; uart={uart:?}"); |
| 1607 | assert!( |
| 1608 | !uart.contains("unhandled exception"), |
| 1609 | "the linked program faulted; uart={uart:?}" |
| 1610 | ); |
| 1611 | assert!( |
| 1612 | uart.contains("as: wrote /a.o") && uart.contains("as: wrote /b.o"), |
| 1613 | "assembler did not emit both objects; uart={uart:?}" |
| 1614 | ); |
| 1615 | assert!( |
| 1616 | uart.contains("ld: wrote /prog"), |
| 1617 | "linker did not report success; uart={uart:?}" |
| 1618 | ); |
| 1619 | assert!( |
| 1620 | uart.contains("[exit 42]"), |
| 1621 | "linked program did not exit 42 (relocations wrong?); uart={uart:?}" |
| 1622 | ); |
| 1623 | assert!( |
| 1624 | matches!(outcome, StepOutcome::Halted(0)), |
| 1625 | "shell did not survive and exit cleanly; outcome={outcome:?} uart={uart:?}" |
| 1626 | ); |
| 1627 | } |
| 1628 | |
| 1629 | // The client inlines no I/O, so puts/putc/exit resolve at link time against a |
| 1630 | // separately assembled stdlib.s. Covers CALL_PLT, a local call, and PCREL_HI20. |
| 1631 | #[test] |
| 1632 | fn kernel_ld_links_stdlib_and_runs() { |
| 1633 | let client_s = b"\ |
| 1634 | .globl _start |
| 1635 | .text |
| 1636 | _start: |
| 1637 | la a0, msg |
| 1638 | call puts |
| 1639 | li a0, 33 |
nothing calls this directly
no test coverage detected