MCPcopy Create free account
hub / github.com/LPC4/Full-Stack / process_create_increments_pid

Function process_create_increments_pid

tests/integration/platform_stdlib.rs:1232–1273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1230 "expected error to mention 'kmain', got: {}",
1231 err.message
1232 );
1233}
1234
1235#[test]
1236fn kernel_boot_kmalloc_works() {
1237 let (uart, exit) = run_kernel_hll(
1238 r#"
1239heap := import("kernel/mm/kernel_heap.hll")
1240system := import("kernel/arch/riscv64/system.hll")
1241external klog_ok: (msg: u8*)
1242
1243kmain: () {
1244 buf: u8* = heap.alloc_bytes(16)
1245 buf[0] = 72
1246 buf[1] = 105
1247 buf[2] = 33
1248 buf[3] = 0
1249 klog_ok(buf)
1250 system.shutdown(0)
1251}
1252"#,
1253 );
1254 assert_eq!(uart, "[ OK ] Hi!\n");
1255 assert_eq!(exit, Some(0));
1256}
1257
1258// --- Cross-module linking tests ---
1259
1260/// Compile and link two simple modules (plus stdlib): one provides a function,
1261/// the other calls it. Verifies CallPlt relocations resolve correctly.
1262#[test]
1263fn cross_module_call_works() {
1264 let mut pipeline = CompilationPipeline::new();
1265 pipeline.set_write_artifacts(false);
1266
1267 // Stdlib provides _start -> main -> exit.
1268 let stdlib_objs =
1269 CompilationPipeline::compile_stdlib_objects(TargetMode::Hosted).expect("stdlib compile");
1270
1271 let module_a = r#"
1272 export add_one: (x: i32) -> i32 {
1273 return x + 1
1274 }
1275 "#;
1276

Callers

nothing calls this directly

Calls 1

run_kernel_hllFunction · 0.70

Tested by

no test coverage detected