()
| 716 | cached_kernel(), |
| 717 | Some(&shell), |
| 718 | Some(&image), |
| 719 | session, |
| 720 | 80_000_000, |
| 721 | ); |
| 722 | |
| 723 | assert!(!uart.contains("PANIC!"), "kernel panicked; uart={uart:?}"); |
| 724 | assert!( |
| 725 | uart.contains("HLL shell ready"), |
| 726 | "shell did not start; uart={uart:?}" |
| 727 | ); |
| 728 | assert!( |
| 729 | uart.contains("home"), |
| 730 | "ls of root did not list home; uart={uart:?}" |
| 731 | ); |
| 732 | assert!( |
| 733 | uart.contains("hello.elf"), |
| 734 | "ls of /home did not list the program; uart={uart:?}" |
| 735 | ); |
| 736 | assert!( |
| 737 | uart.contains("HELLO_FROM_CHILD"), |
| 738 | "run did not execute the program; uart={uart:?}" |
| 739 | ); |
| 740 | assert!( |
| 741 | matches!(outcome, StepOutcome::Halted(0)), |
| 742 | "exit did not halt the VM cleanly; outcome={outcome:?} uart={uart:?}" |
| 743 | ); |
| 744 | } |
| 745 | |
| 746 | // Non-zero global initializers must survive the ELF/sys_exec load path too, not |
| 747 | // just the direct VM loader the run_hll tests cover. |
| 748 | #[test] |
| 749 | fn kernel_shell_exec_carries_global_initializers() { |
| 750 | let shell = compile_hosted_program("shell"); |
| 751 | |
| 752 | let child = compile_hosted( |
| 753 | r#" |
| 754 | external print_int: (value: i64) -> i32 |
| 755 | external console_writeln: (str: u8*) |
| 756 | g: i64 = 12345 |
| 757 | arr: i64[3] = [100, 200, 300] |
| 758 | main: () -> i32 { |
| 759 | console_writeln("SCALAR".ptr) |
| 760 | print_int(g) |
| 761 | console_writeln("ARRAY".ptr) |
| 762 | print_int(arr[0] + arr[1] + arr[2]) |
| 763 | return 0 |
| 764 | } |
| 765 | "#, |
| 766 | ); |
| 767 | let exec_file = assembled_to_elf_file(&child); |
| 768 | |
| 769 | let image = build_fs_image(&[FsEntry::File { |
| 770 | path: "/g.elf", |
| 771 | data: &exec_file, |
| 772 | }]); |
| 773 |
nothing calls this directly
no test coverage detected