From 6b1fff796b54543c0ccba5727effd9b4bb776106 Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Fri, 13 May 2022 17:35:06 +0000 Subject: [PATCH] DebugConsole: add kata_object_alloc_in_cnode test to test_obj_alloc Change-Id: Iaf53ab57720c65f7545211fecab43211bf7513bf GitOrigin-RevId: 63114c23e82cdab2a2deddb55b00441ed3de33db --- .../DebugConsole/kata-shell/src/lib.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/apps/system/components/DebugConsole/kata-shell/src/lib.rs b/apps/system/components/DebugConsole/kata-shell/src/lib.rs index c52ae3d..61c99c0 100644 --- a/apps/system/components/DebugConsole/kata-shell/src/lib.rs +++ b/apps/system/components/DebugConsole/kata-shell/src/lib.rs @@ -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!")?) }