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