()
| 1713 | uart.contains("ld: wrote /prog"), |
| 1714 | "linker did not report success; uart={uart:?}" |
| 1715 | ); |
| 1716 | assert!( |
| 1717 | uart.contains("HLL0"), |
| 1718 | "program marker missing; uart={uart:?}" |
| 1719 | ); |
| 1720 | assert!( |
| 1721 | uart.contains("[exit 36]"), |
| 1722 | "compiled program did not exit 36; uart={uart:?}" |
| 1723 | ); |
| 1724 | assert!( |
| 1725 | matches!(outcome, StepOutcome::Halted(0)), |
| 1726 | "shell did not survive the run and exit cleanly; outcome={outcome:?} uart={uart:?}" |
| 1727 | ); |
| 1728 | } |
| 1729 | |
| 1730 | // Repro of the interactive self-hosting session: cwd /home/src, relative paths to |
| 1731 | // cc/as, and bare-name execution (`hello`, not `run /abs/path`). |
| 1732 | #[test] |
| 1733 | fn kernel_cc_interactive_relative_paths_and_barename() { |
| 1734 | let (outcome, uart) = run_tool_session( |
| 1735 | &["as", "cc", "ld"], |
| 1736 | &[ |
| 1737 | ("/home/src/hello.hll", user::CC_DEMO_HLL.as_bytes()), |
| 1738 | ("/home/src/stdlib.s", user::EXAMPLE_STDLIB_S.as_bytes()), |
| 1739 | ], |
| 1740 | "cd /home/src\ncc hello.hll hello.s\nas hello.s hello.o\nas stdlib.s stdlib.o\n\ |
| 1741 | ld stdlib.o hello.o hello\nhello\nexit\n", |
| 1742 | 300_000_000, |
| 1743 | ); |
| 1744 | |
| 1745 | assert!(!uart.contains("PANIC!"), "kernel panicked; uart={uart:?}"); |
| 1746 | assert!( |
| 1747 | !uart.contains("unhandled exception"), |
| 1748 | "the compiled program faulted; uart={uart:?}" |
| 1749 | ); |
| 1750 | assert!( |
| 1751 | uart.contains("HLL0"), |
| 1752 | "program marker missing; uart={uart:?}" |
| 1753 | ); |
| 1754 | assert!( |
| 1755 | uart.contains("[exit 36]"), |
| 1756 | "compiled program did not exit 36; uart={uart:?}" |
| 1757 | ); |
| 1758 | assert!( |
| 1759 | matches!(outcome, StepOutcome::Halted(0)), |
| 1760 | "shell did not survive and exit cleanly; outcome={outcome:?} uart={uart:?}" |
| 1761 | ); |
| 1762 | } |
| 1763 | |
| 1764 | // Regression: a trailing space on a `cc`/`as` output operand once became part of |
| 1765 | // the filename. The extensionless output also covers cwd resolution. |
| 1766 | #[test] |
| 1767 | fn kernel_cc_tool_arg_trailing_space() { |
| 1768 | // Trailing spaces after the output operand on the cc/as/ld invocations. |
| 1769 | let (outcome, uart) = run_tool_session( |
| 1770 | &["as", "cc", "ld"], |
| 1771 | &[ |
| 1772 | ("/home/src/hello.hll", user::CC_DEMO_HLL.as_bytes()), |
nothing calls this directly
no test coverage detected