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