@@ -2735,3 +2735,61 @@ pub fn test_which_coreutil() {
27352735 }
27362736 }
27372737}
2738+
2739+ /// Test the `cat` coreutil
2740+ ///
2741+ /// Verifies that /bin/cat correctly outputs file contents.
2742+ pub fn test_cat_coreutil ( ) {
2743+ log:: info!( "Testing cat coreutil (file concatenation)" ) ;
2744+
2745+ #[ cfg( feature = "testing" ) ]
2746+ let cat_test_elf_buf = crate :: userspace_test:: get_test_binary ( "cat_test" ) ;
2747+ #[ cfg( feature = "testing" ) ]
2748+ let cat_test_elf: & [ u8 ] = & cat_test_elf_buf;
2749+ #[ cfg( not( feature = "testing" ) ) ]
2750+ let cat_test_elf = & create_hello_world_elf ( ) ;
2751+
2752+ match crate :: process:: creation:: create_user_process (
2753+ String :: from ( "cat_test" ) ,
2754+ cat_test_elf,
2755+ ) {
2756+ Ok ( pid) => {
2757+ log:: info!( "Created cat_test process with PID {:?}" , pid) ;
2758+ log:: info!( "cat_test: process scheduled for execution." ) ;
2759+ log:: info!( " -> Userspace will emit CAT_TEST_PASSED marker if successful" ) ;
2760+ }
2761+ Err ( e) => {
2762+ log:: error!( "Failed to create cat_test process: {}" , e) ;
2763+ log:: error!( "cat_test cannot run without valid userspace process" ) ;
2764+ }
2765+ }
2766+ }
2767+
2768+ /// Test the `ls` coreutil
2769+ ///
2770+ /// Verifies that /bin/ls correctly lists directory contents.
2771+ pub fn test_ls_coreutil ( ) {
2772+ log:: info!( "Testing ls coreutil (directory listing)" ) ;
2773+
2774+ #[ cfg( feature = "testing" ) ]
2775+ let ls_test_elf_buf = crate :: userspace_test:: get_test_binary ( "ls_test" ) ;
2776+ #[ cfg( feature = "testing" ) ]
2777+ let ls_test_elf: & [ u8 ] = & ls_test_elf_buf;
2778+ #[ cfg( not( feature = "testing" ) ) ]
2779+ let ls_test_elf = & create_hello_world_elf ( ) ;
2780+
2781+ match crate :: process:: creation:: create_user_process (
2782+ String :: from ( "ls_test" ) ,
2783+ ls_test_elf,
2784+ ) {
2785+ Ok ( pid) => {
2786+ log:: info!( "Created ls_test process with PID {:?}" , pid) ;
2787+ log:: info!( "ls_test: process scheduled for execution." ) ;
2788+ log:: info!( " -> Userspace will emit LS_TEST_PASSED marker if successful" ) ;
2789+ }
2790+ Err ( e) => {
2791+ log:: error!( "Failed to create ls_test process: {}" , e) ;
2792+ log:: error!( "ls_test cannot run without valid userspace process" ) ;
2793+ }
2794+ }
2795+ }
0 commit comments