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)
| 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] |
| 3251 | fn 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( |
nothing calls this directly
no outgoing calls
no test coverage detected