@@ -197,13 +197,16 @@ fn test_du_soft_link() {
197197 let ts = TestScenario :: new ( util_name ! ( ) ) ;
198198 let at = & ts. fixtures ;
199199
200- at. symlink_file ( SUB_FILE , SUB_LINK ) ;
200+ // Create the directory and file structure explicitly for this test
201+ at. mkdir_all ( "subdir/links" ) ;
202+ at. write ( "subdir/links/subwords.txt" , & "hello world\n " . repeat ( 100 ) ) ;
203+ at. symlink_file ( "subdir/links/subwords.txt" , "subdir/links/sublink.txt" ) ;
201204
202- let result = ts. ucmd ( ) . arg ( SUB_DIR_LINKS ) . succeeds ( ) ;
205+ let result = ts. ucmd ( ) . arg ( "subdir/links" ) . succeeds ( ) ;
203206
204207 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
205208 {
206- let result_reference = unwrap_or_return ! ( expected_result( & ts, & [ SUB_DIR_LINKS ] ) ) ;
209+ let result_reference = unwrap_or_return ! ( expected_result( & ts, & [ "subdir/links" ] ) ) ;
207210 if result_reference. succeeded ( ) {
208211 assert_eq ! ( result. stdout_str( ) , result_reference. stdout_str( ) ) ;
209212 return ;
@@ -814,12 +817,18 @@ fn test_du_no_exec_permission() {
814817#[ cfg( not( target_os = "openbsd" ) ) ]
815818fn test_du_one_file_system ( ) {
816819 let ts = TestScenario :: new ( util_name ! ( ) ) ;
820+ let at = & ts. fixtures ;
817821
818- let result = ts. ucmd ( ) . arg ( "-x" ) . arg ( SUB_DIR ) . succeeds ( ) ;
822+ // Create the directory structure explicitly for this test
823+ at. mkdir_all ( "subdir/deeper/deeper_dir" ) ;
824+ at. write ( "subdir/deeper/deeper_dir/deeper_words.txt" , "hello world" ) ;
825+ at. write ( "subdir/deeper/words.txt" , "world" ) ;
826+
827+ let result = ts. ucmd ( ) . arg ( "-x" ) . arg ( "subdir/deeper" ) . succeeds ( ) ;
819828
820829 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
821830 {
822- let result_reference = unwrap_or_return ! ( expected_result( & ts, & [ "-x" , SUB_DIR ] ) ) ;
831+ let result_reference = unwrap_or_return ! ( expected_result( & ts, & [ "-x" , "subdir/deeper" ] ) ) ;
823832 if result_reference. succeeded ( ) {
824833 assert_eq ! ( result. stdout_str( ) , result_reference. stdout_str( ) ) ;
825834 return ;
@@ -832,6 +841,14 @@ fn test_du_one_file_system() {
832841#[ cfg( not( target_os = "openbsd" ) ) ]
833842fn test_du_threshold ( ) {
834843 let ts = TestScenario :: new ( util_name ! ( ) ) ;
844+ let at = & ts. fixtures ;
845+
846+ // Create the directory structure explicitly for this test
847+ at. mkdir_all ( "subdir/links" ) ;
848+ at. mkdir_all ( "subdir/deeper/deeper_dir" ) ;
849+ // Create files with specific sizes to test threshold
850+ at. write ( "subdir/links/bigfile.txt" , & "x" . repeat ( 10000 ) ) ; // ~10K file
851+ at. write ( "subdir/deeper/deeper_dir/smallfile.txt" , "small" ) ; // small file
835852
836853 let threshold = if cfg ! ( windows) { "7K" } else { "10K" } ;
837854
0 commit comments