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

Function kernel_pipe_ls_hides_temp_file

tests/integration/kernel_integration.rs:2652–2686  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2650#[test]
2651fn kernel_cat_stdin_redirect() {
2652 let shell = compile_hosted_program("shell");
2653 let image = build_fs_image(&[FsEntry::File {
2654 path: "/in.txt",
2655 data: b"FROM_STDIN\n",
2656 }]);
2657
2658 let session = "cat < /in.txt\nexit\n";
2659 let (_, outcome, uart) = boot_kernel(
2660 cached_kernel(),
2661 Some(&shell),
2662 Some(&image),
2663 session,
2664 120_000_000,
2665 );
2666
2667 assert!(!uart.contains("PANIC!"), "kernel panicked; uart={uart:?}");
2668 // "FROM_STDIN" is only in the file, never in the typed command, so any sighting
2669 // is cat printing the redirected input.
2670 assert!(
2671 uart.contains("FROM_STDIN"),
2672 "cat did not read redirected stdin; uart={uart:?}"
2673 );
2674 assert!(
2675 matches!(outcome, RunOutcome::Halted(0)),
2676 "shell did not exit cleanly; outcome={outcome:?} uart={uart:?}"
2677 );
2678}
2679
2680// Input is injected mid-run, the way the GUI does it, so the shell really sleeps
2681// in readchar and an incoming byte must raise the RX interrupt to wake it.
2682#[test]
2683fn kernel_shell_interrupt_wake_lists_running_background_job() {
2684 let shell = compile_hosted_program("shell");
2685 // A background job that runs forever and never reads input, so it stays the
2686 // sole runnable process while the shell is blocked waiting for a keystroke.
2687 let spinner = compile_hosted(
2688 r#"
2689external sys_exit: (code: i64)

Callers

nothing calls this directly

Calls 4

compile_hosted_programFunction · 0.85
build_fs_imageFunction · 0.85
boot_kernelFunction · 0.85
cached_kernelFunction · 0.85

Tested by

no test coverage detected