DebugConsole: add kata_object_alloc_in_cnode test to test_obj_alloc

Change-Id: Iaf53ab57720c65f7545211fecab43211bf7513bf
GitOrigin-RevId: 63114c23e82cdab2a2deddb55b00441ed3de33db
This commit is contained in:
Sam Leffler
2022-05-13 17:35:06 +00:00
parent 876c7148e7
commit 6b1fff796b

View File

@@ -674,6 +674,29 @@ fn test_obj_alloc_command(output: &mut dyn io::Write) -> Result<(), CommandError
writeln!(output, "Cnode free err: {:?} {:?}", cnode, e)?;
}
// Batch allocate using the newer api that constructs a CNode based
// on the batch of objects specified.
match kata_object_alloc_in_cnode(
vec![
ObjDesc::new(seL4_TCBObject, 1, 0), // 1 tcb
ObjDesc::new(seL4_EndpointObject, 1, 1), // 1 endpoiints
ObjDesc::new(seL4_ReplyObject, 1, 2), // 1 replys
ObjDesc::new(seL4_SchedContextObject, // 1 sched context
seL4_MinSchedContextBits, 3),
ObjDesc::new(seL4_RISCV_4K_Page, 2, 4), // 2 4K pages
],
) {
Ok(objs) => {
writeln!(output, "kata_object_alloc_in_cnode ok: {:?}", objs)?;
if let Err(e) = kata_object_free_in_cnode(&objs) {
writeln!(output, "kata_object_free_in_cnode failed: {:?}", e)?;
}
}
Err(e) => {
writeln!(output, "kata_object_alloc_in_cnode failed: {:?}", e)?;
}
}
Ok(writeln!(output, "All tests passed!")?)
}