()
| 1092 | klog_ok("boot".ptr) |
| 1093 | kshutdown(0) |
| 1094 | } |
| 1095 | "#, |
| 1096 | ); |
| 1097 | assert_eq!(uart, "[ OK ] boot\n"); |
| 1098 | assert_eq!(exit, Some(0)); |
| 1099 | } |
| 1100 | |
| 1101 | #[test] |
| 1102 | fn kernel_boot_multiple_log_levels() { |
| 1103 | let (uart, exit) = run_kernel_hll( |
| 1104 | r#" |
| 1105 | external klog_ok: (msg: u8*) |
| 1106 | external klog_warn: (msg: u8*) |
| 1107 | external klog_error: (msg: u8*) |
| 1108 | external klog_int: (label: u8*, val: i64) |
| 1109 | external kshutdown: (code: i64) |
| 1110 | |
| 1111 | kmain: () { |
| 1112 | klog_ok("console init".ptr) |
| 1113 | klog_warn("heap not ready".ptr) |
| 1114 | klog_error("test error".ptr) |
| 1115 | klog_int("hart".ptr, 0) |
| 1116 | kshutdown(0) |
| 1117 | } |
| 1118 | "#, |
| 1119 | ); |
| 1120 | assert_eq!( |
| 1121 | uart, |
| 1122 | "[ OK ] console init\n[ WARN ] heap not ready\n[ ERR ] test error\nhart: 0\n" |
| 1123 | ); |
| 1124 | assert_eq!(exit, Some(0)); |
| 1125 | } |
| 1126 | |
| 1127 | #[test] |
| 1128 | fn kernel_boot_kshutdown_nonzero_exit() { |
| 1129 | let (uart, exit) = run_kernel_hll( |
| 1130 | r#" |
nothing calls this directly
no test coverage detected