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