1 if ! test -x $DEBUGFS_EXE; then 2 echo "$test_name: $test_description: skipped (no debugfs)" 3 return 0 4 fi 5 6 FSCK_OPT=-fy 7 OUT=$test_name.log 8 if [ -f $test_dir/expect.gz ]; then 9 EXP=$test_name.tmp 10 gunzip < $test_dir/expect.gz > $EXP1 11 else 12 EXP=$test_dir/expect 13 fi 14 15 cat > $TMPFILE.conf << ENDL 16 [fs_types] 17 ext4 = { 18 base_features = sparse_super,filetype,resize_inode,dir_index,ext_attr,^has_journal,^extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^64bit 19 blocksize = 1024 20 inode_size = 256 21 inode_ratio = 16384 22 } 23 ENDL 24 MKE2FS_CONFIG=$TMPFILE.conf $MKE2FS -F -o Linux -b 1024 -O ^bigalloc -T ext4 $TMPFILE 65536 > $OUT.new 2>&1 25 rm -f $TMPFILE.conf 26 27 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1 28 status=$? 29 echo Exit status is $status >> $OUT.new 30 31 echo "debugfs write files" >> $OUT.new 32 #Files we create: 33 # a: fallocate a 40k file 34 # k: one big file 35 base=5000 36 cat > $TMPFILE.cmd << ENDL 37 write /dev/null a 38 sif /a bmap[2] 8000 39 sif /a size 40960 40 sif /a i_blocks 2 41 setb 8000 42 fallocate /a 0 39 43 44 write /dev/null b 45 sif /b size 10240000 46 sif /b bmap[0] 10000 47 sif /b i_blocks 2 48 setb 10000 49 fallocate /b 0 9999 50 ENDL 51 echo "stat /a" >> $TMPFILE.cmd2 52 echo "stat /b" >> $TMPFILE.cmd2 53 54 $DEBUGFS -w -f $TMPFILE.cmd $TMPFILE > /dev/null 2>&1 55 $DEBUGFS -f $TMPFILE.cmd2 $TMPFILE >> $OUT.new 2>&1 56 57 $FSCK -fy -N test_filesys $TMPFILE >> $OUT.new 2>&1 58 status=$? 59 echo Exit status is $status >> $OUT.new 60 sed -f $cmd_dir/filter.sed -e '/^.*time:.*$/d' $OUT.new > $OUT 61 rm -f $TMPFILE $TMPFILE.cmd $TMPFILE.cmd2 $OUT.new 62 63 cmp -s $OUT $EXP 64 status=$? 65 66 if [ "$status" = 0 ] ; then 67 echo "$test_name: $test_description: ok" 68 touch $test_name.ok 69 else 70 echo "$test_name: $test_description: failed" 71 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 72 rm -f $test_name.tmp 73 fi 74 75 unset IMAGE FSCK_OPT OUT EXP 76