1 if test -x $DEBUGFS_EXE; then 2 3 test_description="create fs image from dir" 4 MKFS_DIR=$TMPFILE.dir 5 OUT=$test_name.log 6 EXP=$test_dir/expect 7 8 rm -rf $MKFS_DIR 9 mkdir -p $MKFS_DIR 10 touch $MKFS_DIR/emptyfile 11 dd if=/dev/zero bs=1024 count=32 2> /dev/null | tr '\0' 'a' > $MKFS_DIR/bigfile 12 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1024 2> /dev/null 13 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=524288 conv=notrunc 2> /dev/null 14 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1048576 conv=notrunc 2> /dev/null 15 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=536870912 conv=notrunc 2> /dev/null 16 echo "M" | dd of=$MKFS_DIR/sparsefile bs=1 count=1 seek=1073741824 conv=notrunc 2> /dev/null 17 dd if=/dev/zero of=$MKFS_DIR/bigzerofile bs=1 count=1 seek=1073741824 2> /dev/null 18 ln $MKFS_DIR/bigzerofile $MKFS_DIR/bigzerofile_hardlink 19 ln -s /silly_bs_link $MKFS_DIR/silly_bs_link 20 mkdir $MKFS_DIR/emptydir 21 mkdir $MKFS_DIR/dir 22 echo "Test me" > $MKFS_DIR/dir/file 23 24 $MKE2FS -q -F -o Linux -T ext4 -O metadata_csum,64bit -E lazy_itable_init=1 -b 1024 -d $MKFS_DIR $TMPFILE 16384 > $OUT 2>&1 25 26 $DUMPE2FS $TMPFILE >> $OUT 2>&1 27 cat > $TMPFILE.cmd << ENDL 28 stat /emptyfile 29 stat /bigfile 30 stat /sparsefile 31 stat /bigzerofile 32 stat /fifo 33 stat /emptydir 34 stat /dir 35 stat /dir/file 36 ENDL 37 $DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | egrep "(stat|Size:|Type:)" | sed -f $test_dir/output.sed >> $OUT 38 39 cat > $TMPFILE.cmd << ENDL 40 ex /emptyfile 41 ex /bigfile 42 ex /sparsefile 43 ex /bigzerofile 44 ex /dir 45 ex /dir/file 46 ENDL 47 $DEBUGFS -f $TMPFILE.cmd $TMPFILE 2>&1 | sed -f $test_dir/output.sed >> $OUT 2>&1 48 49 $FSCK -f -n $TMPFILE >> $OUT 2>&1 50 51 sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" < $OUT > $OUT.tmp 52 mv $OUT.tmp $OUT 53 54 # Do the verification 55 cmp -s $OUT $EXP 56 status=$? 57 58 if [ "$status" = 0 ] ; then 59 echo "$test_name: $test_description: ok" 60 touch $test_name.ok 61 else 62 echo "$test_name: $test_description: failed" 63 diff $DIFF_OPTS $EXP $OUT > $test_name.failed 64 fi 65 66 rm -rf $TMPFILE.cmd $MKFS_DIR $OUT.sed 67 unset MKFS_DIR OUT EXP 68 69 else #if test -x $DEBUGFS_EXE; then 70 echo "$test_name: $test_description: skipped" 71 fi 72