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