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

Function inode_present

tests/integration/kernel_integration.rs:3245–3264  ·  view source on GitHub ↗

Scan the inode table for an entry of the given type (1=file, 2=dir) and name. Returns true if present. Used by the file-management test to assert on-disk state directly, since the shell echoes typed commands and UART substring checks for path names would match the echo rather than real FS effects.

(image: &[u8], name: &str, ty: u16)

Source from the content-addressed store, hash-verified

3243 }
3244 }
3245 false
3246}
3247
3248// Drive the shell's file-management commands (mkdir/touch/rm/mv/rmdir) and
3249// verify their effects on the on-disk inode table.
3250#[test]
3251fn kernel_shell_file_management() {
3252 let shell = compile_hosted_program("shell");
3253
3254 // Start from an empty FS so the only inodes are the root plus what the
3255 // session creates.
3256 let image = build_fs_image(&[]);
3257
3258 // Final state: /work and /work/renamed.txt exist, keep.txt and temp.txt are
3259 // gone.
3260 let session = "mkdir /work\n\
3261 touch /work/keep.txt\n\
3262 touch /work/temp.txt\n\
3263 rm /work/temp.txt\n\
3264 mv /work/keep.txt /work/renamed.txt\n\
3265 exit\n";
3266
3267 let (vm, outcome, uart) = boot_kernel(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected