Whamcloud - gitweb
tests: verify rebuilding of sparse extent trees & block map file conversion
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 21 Apr 2015 14:40:50 +0000 (10:40 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 21 Apr 2015 20:23:09 +0000 (16:23 -0400)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
31 files changed:
tests/f_collapse_extent_tree/expect.1 [new file with mode: 0644]
tests/f_collapse_extent_tree/expect.2 [new file with mode: 0644]
tests/f_collapse_extent_tree/image.gz [new file with mode: 0644]
tests/f_collapse_extent_tree/name [new file with mode: 0644]
tests/f_collapse_extent_tree/script [new file with mode: 0644]
tests/f_compress_extent_tree_level/expect.1 [new file with mode: 0644]
tests/f_compress_extent_tree_level/expect.2 [new file with mode: 0644]
tests/f_compress_extent_tree_level/image.gz [new file with mode: 0644]
tests/f_compress_extent_tree_level/name [new file with mode: 0644]
tests/f_compress_extent_tree_level/script [new file with mode: 0644]
tests/f_convert_bmap/expect.1 [new file with mode: 0644]
tests/f_convert_bmap/expect.2 [new file with mode: 0644]
tests/f_convert_bmap/image.gz [new file with mode: 0644]
tests/f_convert_bmap/name [new file with mode: 0644]
tests/f_convert_bmap/script [new file with mode: 0644]
tests/f_convert_bmap_and_extent/expect.1 [new file with mode: 0644]
tests/f_convert_bmap_and_extent/expect.2 [new file with mode: 0644]
tests/f_convert_bmap_and_extent/image.gz [new file with mode: 0644]
tests/f_convert_bmap_and_extent/name [new file with mode: 0644]
tests/f_convert_bmap_and_extent/script [new file with mode: 0644]
tests/f_extent_too_deep/expect.1 [new file with mode: 0644]
tests/f_extent_too_deep/expect.2 [new file with mode: 0644]
tests/f_extent_too_deep/image.gz [new file with mode: 0644]
tests/f_extent_too_deep/name [new file with mode: 0644]
tests/f_extent_too_deep/script [new file with mode: 0644]
tests/f_opt_extent/expect [new file with mode: 0644]
tests/f_opt_extent/name [new file with mode: 0644]
tests/f_opt_extent/script [new file with mode: 0644]
tests/f_opt_extent_ext3/expect [new file with mode: 0644]
tests/f_opt_extent_ext3/name [new file with mode: 0644]
tests/f_opt_extent_ext3/script [new file with mode: 0644]

diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1
new file mode 100644 (file)
index 0000000..e2eb65e
--- /dev/null
@@ -0,0 +1,16 @@
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 1   1/  1     0 -     0     9              1
+ 1/ 1   1/  1     0 -     0    10 -    10      1 
+Pass 1: Checking inodes, blocks, and sizes
+Inode 12 extent tree (at level 1) could be shorter.  Fix? yes
+
+Pass 1E: Optimizing extent trees
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 1
diff --git a/tests/f_collapse_extent_tree/expect.2 b/tests/f_collapse_extent_tree/expect.2
new file mode 100644 (file)
index 0000000..a1d28b1
--- /dev/null
@@ -0,0 +1,10 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 0
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 0   1/  1     0 -     0    10 -    10      1 
diff --git a/tests/f_collapse_extent_tree/image.gz b/tests/f_collapse_extent_tree/image.gz
new file mode 100644 (file)
index 0000000..97036cc
Binary files /dev/null and b/tests/f_collapse_extent_tree/image.gz differ
diff --git a/tests/f_collapse_extent_tree/name b/tests/f_collapse_extent_tree/name
new file mode 100644 (file)
index 0000000..83e506f
--- /dev/null
@@ -0,0 +1 @@
+extent tree can be collapsed one level
diff --git a/tests/f_collapse_extent_tree/script b/tests/f_collapse_extent_tree/script
new file mode 100644 (file)
index 0000000..ee18438
--- /dev/null
@@ -0,0 +1,118 @@
+if [ "$DESCRIPTION"x != x ]; then
+       test_description="$DESCRIPTION"
+fi
+if [ "$IMAGE"x = x ]; then
+       IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+       FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+       SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+       OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+       OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+       if [ -f $test_dir/expect.1.gz ]; then
+               EXP1=$test_name.1.tmp
+               gunzip < $test_dir/expect.1.gz > $EXP1
+       else
+               EXP1=$test_dir/expect.1
+       fi
+fi
+
+if [ "$EXP2"x = x ]; then
+       if [ -f $test_dir/expect.2.gz ]; then
+               EXP2=$test_name.2.tmp
+               gunzip < $test_dir/expect.2.gz > $EXP2
+       else
+               EXP2=$test_dir/expect.2
+       fi
+fi
+
+if [ "$SKIP_GUNZIP" != "true" ] ; then
+       gunzip < $IMAGE > $TMPFILE
+fi
+
+cp /dev/null $OUT1
+
+eval $PREP_CMD
+
+echo 'ex /a' > $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
+rm -rf $TMPFILE.cmd
+$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
+rm -f $OUT1.new
+
+if [ "$ONE_PASS_ONLY" != "true" ]; then
+       $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+       status=$?
+       echo Exit status is $status >> $OUT2.new
+       echo 'ex /a' > $TMPFILE.cmd
+       $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
+       rm -rf $TMPFILE.cmd
+       sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
+       rm -f $OUT2.new
+fi
+
+eval $AFTER_CMD
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+       rm -f $test_name.ok $test_name.failed
+       cmp -s $OUT1 $EXP1
+       status1=$?
+       if [ "$ONE_PASS_ONLY" != "true" ]; then
+               cmp -s $OUT2 $EXP2
+               status2=$?
+       else
+               status2=0
+       fi
+       if [ "$PASS_ZERO" = "true" ]; then
+               cmp -s $test_name.0.log $test_dir/expect.0
+               status3=$?
+       else
+               status3=0
+       fi
+
+       if [ -z "$test_description" ] ; then
+               description="$test_name"
+       else
+               description="$test_name: $test_description"
+       fi
+
+       if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
+               echo "$description: ok"
+               touch $test_name.ok
+       else
+               echo "$description: failed"
+               rm -f $test_name.failed
+               if [ "$PASS_ZERO" = "true" ]; then
+                       diff $DIFF_OPTS $test_dir/expect.0 \
+                               $test_name.0.log >> $test_name.failed
+               fi
+               diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
+               if [ "$ONE_PASS_ONLY" != "true" ]; then
+                       diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
+               fi
+       fi
+       rm -f tmp_expect
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+       unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
+       unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
+       unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
+fi
+
diff --git a/tests/f_compress_extent_tree_level/expect.1 b/tests/f_compress_extent_tree_level/expect.1
new file mode 100644 (file)
index 0000000..1159f24
--- /dev/null
@@ -0,0 +1,23 @@
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 1   1/  2     0 -    16     9             17
+ 1/ 1   1/  4     0 -     0    10 -    10      1 
+ 1/ 1   2/  4    11 -    11   100 -   100      1 
+ 1/ 1   3/  4    13 -    13   101 -   101      1 
+ 1/ 1   4/  4    15 -    15   102 -   102      1 
+ 0/ 1   2/  2    17 -    21    12              5
+ 1/ 1   1/  3    17 -    17   103 -   103      1 
+ 1/ 1   2/  3    19 -    19   104 -   104      1 
+ 1/ 1   3/  3    21 -    21   105 -   105      1 
+Pass 1: Checking inodes, blocks, and sizes
+Inode 12 extent tree (at (level 1) could be narrower.  Fix? yes
+
+Pass 1E: Optimizing extent trees
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks
+Exit status is 1
diff --git a/tests/f_compress_extent_tree_level/expect.2 b/tests/f_compress_extent_tree_level/expect.2
new file mode 100644 (file)
index 0000000..07d1082
--- /dev/null
@@ -0,0 +1,17 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/128 files (8.3% non-contiguous), 26/512 blocks
+Exit status is 0
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 1   1/  1     0 -    21     9             22
+ 1/ 1   1/  7     0 -     0    10 -    10      1 
+ 1/ 1   2/  7    11 -    11   100 -   100      1 
+ 1/ 1   3/  7    13 -    13   101 -   101      1 
+ 1/ 1   4/  7    15 -    15   102 -   102      1 
+ 1/ 1   5/  7    17 -    17   103 -   103      1 
+ 1/ 1   6/  7    19 -    19   104 -   104      1 
+ 1/ 1   7/  7    21 -    21   105 -   105      1 
diff --git a/tests/f_compress_extent_tree_level/image.gz b/tests/f_compress_extent_tree_level/image.gz
new file mode 100644 (file)
index 0000000..a552a58
Binary files /dev/null and b/tests/f_compress_extent_tree_level/image.gz differ
diff --git a/tests/f_compress_extent_tree_level/name b/tests/f_compress_extent_tree_level/name
new file mode 100644 (file)
index 0000000..fde4f4a
--- /dev/null
@@ -0,0 +1 @@
+compress an extent tree level
diff --git a/tests/f_compress_extent_tree_level/script b/tests/f_compress_extent_tree_level/script
new file mode 100644 (file)
index 0000000..ee18438
--- /dev/null
@@ -0,0 +1,118 @@
+if [ "$DESCRIPTION"x != x ]; then
+       test_description="$DESCRIPTION"
+fi
+if [ "$IMAGE"x = x ]; then
+       IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+       FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+       SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+       OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+       OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+       if [ -f $test_dir/expect.1.gz ]; then
+               EXP1=$test_name.1.tmp
+               gunzip < $test_dir/expect.1.gz > $EXP1
+       else
+               EXP1=$test_dir/expect.1
+       fi
+fi
+
+if [ "$EXP2"x = x ]; then
+       if [ -f $test_dir/expect.2.gz ]; then
+               EXP2=$test_name.2.tmp
+               gunzip < $test_dir/expect.2.gz > $EXP2
+       else
+               EXP2=$test_dir/expect.2
+       fi
+fi
+
+if [ "$SKIP_GUNZIP" != "true" ] ; then
+       gunzip < $IMAGE > $TMPFILE
+fi
+
+cp /dev/null $OUT1
+
+eval $PREP_CMD
+
+echo 'ex /a' > $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
+rm -rf $TMPFILE.cmd
+$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
+rm -f $OUT1.new
+
+if [ "$ONE_PASS_ONLY" != "true" ]; then
+       $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+       status=$?
+       echo Exit status is $status >> $OUT2.new
+       echo 'ex /a' > $TMPFILE.cmd
+       $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
+       rm -rf $TMPFILE.cmd
+       sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
+       rm -f $OUT2.new
+fi
+
+eval $AFTER_CMD
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+       rm -f $test_name.ok $test_name.failed
+       cmp -s $OUT1 $EXP1
+       status1=$?
+       if [ "$ONE_PASS_ONLY" != "true" ]; then
+               cmp -s $OUT2 $EXP2
+               status2=$?
+       else
+               status2=0
+       fi
+       if [ "$PASS_ZERO" = "true" ]; then
+               cmp -s $test_name.0.log $test_dir/expect.0
+               status3=$?
+       else
+               status3=0
+       fi
+
+       if [ -z "$test_description" ] ; then
+               description="$test_name"
+       else
+               description="$test_name: $test_description"
+       fi
+
+       if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
+               echo "$description: ok"
+               touch $test_name.ok
+       else
+               echo "$description: failed"
+               rm -f $test_name.failed
+               if [ "$PASS_ZERO" = "true" ]; then
+                       diff $DIFF_OPTS $test_dir/expect.0 \
+                               $test_name.0.log >> $test_name.failed
+               fi
+               diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
+               if [ "$ONE_PASS_ONLY" != "true" ]; then
+                       diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
+               fi
+       fi
+       rm -f tmp_expect
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+       unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
+       unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
+       unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
+fi
+
diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1
new file mode 100644 (file)
index 0000000..7d2ca86
--- /dev/null
@@ -0,0 +1,26 @@
+debugfs: stat /a
+Inode: 12   Type: regular    Mode:  0644   Flags: 0x0
+Generation: 1573716129    Version: 0x00000000:00000001
+User:     0   Group:     0   Size: 524288
+File ACL: 0    Directory ACL: 0
+Links: 1   Blockcount: 1030
+Fragment:  Address: 0    Number: 0    Size: 0
+ ctime: 0x5457f87a:62ae2980 -- Mon Nov  3 21:49:46 2014
+ atime: 0x5457f87a:61ba0598 -- Mon Nov  3 21:49:46 2014
+ mtime: 0x5457f87a:62ae2980 -- Mon Nov  3 21:49:46 2014
+crtime: 0x5457f87a:61ba0598 -- Mon Nov  3 21:49:46 2014
+Size of extra inode fields: 28
+BLOCKS:
+(0-11):1025-1036, (IND):24, (12-267):1037-1292, (DIND):25, (IND):41, (268-511):1293-1536
+TOTAL: 515
+
+Pass 1: Checking inodes, blocks, and sizes
+Pass 1E: Optimizing extent trees
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/128 files (8.3% non-contiguous), 570/2048 blocks
+Exit status is 1
diff --git a/tests/f_convert_bmap/expect.2 b/tests/f_convert_bmap/expect.2
new file mode 100644 (file)
index 0000000..632d411
--- /dev/null
@@ -0,0 +1,10 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/128 files (0.0% non-contiguous), 570/2048 blocks
+Exit status is 0
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 0   1/  1     0 -   511  1025 -  1536    512 
diff --git a/tests/f_convert_bmap/image.gz b/tests/f_convert_bmap/image.gz
new file mode 100644 (file)
index 0000000..7c22532
Binary files /dev/null and b/tests/f_convert_bmap/image.gz differ
diff --git a/tests/f_convert_bmap/name b/tests/f_convert_bmap/name
new file mode 100644 (file)
index 0000000..67e0d47
--- /dev/null
@@ -0,0 +1 @@
+convert blockmap file to extents file
diff --git a/tests/f_convert_bmap/script b/tests/f_convert_bmap/script
new file mode 100644 (file)
index 0000000..f6b6f62
--- /dev/null
@@ -0,0 +1,117 @@
+if [ "$DESCRIPTION"x != x ]; then
+       test_description="$DESCRIPTION"
+fi
+if [ "$IMAGE"x = x ]; then
+       IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+       FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+       SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+       OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+       OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+       if [ -f $test_dir/expect.1.gz ]; then
+               EXP1=$test_name.1.tmp
+               gunzip < $test_dir/expect.1.gz > $EXP1
+       else
+               EXP1=$test_dir/expect.1
+       fi
+fi
+
+if [ "$EXP2"x = x ]; then
+       if [ -f $test_dir/expect.2.gz ]; then
+               EXP2=$test_name.2.tmp
+               gunzip < $test_dir/expect.2.gz > $EXP2
+       else
+               EXP2=$test_dir/expect.2
+       fi
+fi
+
+if [ "$SKIP_GUNZIP" != "true" ] ; then
+       gunzip < $IMAGE > $TMPFILE
+fi
+
+cp /dev/null $OUT1
+
+eval $PREP_CMD
+
+echo 'stat /a' > $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
+rm -rf $TMPFILE.cmd
+$TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1
+$FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
+rm -f $OUT1.new
+
+$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+status=$?
+echo Exit status is $status >> $OUT2.new
+echo 'ex /a' > $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
+rm -rf $TMPFILE.cmd
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
+rm -f $OUT2.new
+
+eval $AFTER_CMD
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+       rm -f $test_name.ok $test_name.failed
+       cmp -s $OUT1 $EXP1
+       status1=$?
+       if [ "$ONE_PASS_ONLY" != "true" ]; then
+               cmp -s $OUT2 $EXP2
+               status2=$?
+       else
+               status2=0
+       fi
+       if [ "$PASS_ZERO" = "true" ]; then
+               cmp -s $test_name.0.log $test_dir/expect.0
+               status3=$?
+       else
+               status3=0
+       fi
+
+       if [ -z "$test_description" ] ; then
+               description="$test_name"
+       else
+               description="$test_name: $test_description"
+       fi
+
+       if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
+               echo "$description: ok"
+               touch $test_name.ok
+       else
+               echo "$description: failed"
+               rm -f $test_name.failed
+               if [ "$PASS_ZERO" = "true" ]; then
+                       diff $DIFF_OPTS $test_dir/expect.0 \
+                               $test_name.0.log >> $test_name.failed
+               fi
+               diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
+               if [ "$ONE_PASS_ONLY" != "true" ]; then
+                       diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
+               fi
+       fi
+       rm -f tmp_expect
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+       unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
+       unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
+       unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
+fi
+
diff --git a/tests/f_convert_bmap_and_extent/expect.1 b/tests/f_convert_bmap_and_extent/expect.1
new file mode 100644 (file)
index 0000000..7af91aa
--- /dev/null
@@ -0,0 +1,33 @@
+debugfs: stat /a
+Inode: 12   Type: regular    Mode:  0644   Flags: 0x0
+Generation: 1573716129    Version: 0x00000000:00000001
+User:     0   Group:     0   Size: 524288
+File ACL: 0    Directory ACL: 0
+Links: 1   Blockcount: 1030
+Fragment:  Address: 0    Number: 0    Size: 0
+ ctime: 0x5457f87a:62ae2980 -- Mon Nov  3 21:49:46 2014
+ atime: 0x5457f87a:61ba0598 -- Mon Nov  3 21:49:46 2014
+ mtime: 0x5457f87a:62ae2980 -- Mon Nov  3 21:49:46 2014
+crtime: 0x5457f87a:61ba0598 -- Mon Nov  3 21:49:46 2014
+Size of extra inode fields: 28
+BLOCKS:
+(0-11):1025-1036, (IND):24, (12-267):1037-1292, (DIND):25, (IND):41, (268-511):1293-1536
+TOTAL: 515
+
+debugfs: ex /zero
+Level Entries       Logical      Physical Length Flags
+ 0/ 1   1/  1     0 -     8    28              9
+ 1/ 1   1/  4     0 -     0    27 -    27      1 
+ 1/ 1   2/  4     2 -     2    29 -    29      1 
+ 1/ 1   3/  4     4 -     4    31 -    31      1 
+ 1/ 1   4/  4     6 -     6    33 -    33      1 
+Pass 1: Checking inodes, blocks, and sizes
+Pass 1E: Optimizing extent trees
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/128 files (15.4% non-contiguous), 574/2048 blocks
+Exit status is 1
diff --git a/tests/f_convert_bmap_and_extent/expect.2 b/tests/f_convert_bmap_and_extent/expect.2
new file mode 100644 (file)
index 0000000..73765ea
--- /dev/null
@@ -0,0 +1,16 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/128 files (7.7% non-contiguous), 574/2048 blocks
+Exit status is 0
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 0   1/  1     0 -   511  1025 -  1536    512 
+debugfs: ex /zero
+Level Entries       Logical      Physical Length Flags
+ 0/ 0   1/  4     0 -     0    27 -    27      1 
+ 0/ 0   2/  4     2 -     2    29 -    29      1 
+ 0/ 0   3/  4     4 -     4    31 -    31      1 
+ 0/ 0   4/  4     6 -     6    33 -    33      1 
diff --git a/tests/f_convert_bmap_and_extent/image.gz b/tests/f_convert_bmap_and_extent/image.gz
new file mode 100644 (file)
index 0000000..916b493
Binary files /dev/null and b/tests/f_convert_bmap_and_extent/image.gz differ
diff --git a/tests/f_convert_bmap_and_extent/name b/tests/f_convert_bmap_and_extent/name
new file mode 100644 (file)
index 0000000..c9394c6
--- /dev/null
@@ -0,0 +1 @@
+convert blockmap and extents files to extents files
diff --git a/tests/f_convert_bmap_and_extent/script b/tests/f_convert_bmap_and_extent/script
new file mode 100644 (file)
index 0000000..203ab25
--- /dev/null
@@ -0,0 +1,119 @@
+if [ "$DESCRIPTION"x != x ]; then
+       test_description="$DESCRIPTION"
+fi
+if [ "$IMAGE"x = x ]; then
+       IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+       FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+       SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+       OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+       OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+       if [ -f $test_dir/expect.1.gz ]; then
+               EXP1=$test_name.1.tmp
+               gunzip < $test_dir/expect.1.gz > $EXP1
+       else
+               EXP1=$test_dir/expect.1
+       fi
+fi
+
+if [ "$EXP2"x = x ]; then
+       if [ -f $test_dir/expect.2.gz ]; then
+               EXP2=$test_name.2.tmp
+               gunzip < $test_dir/expect.2.gz > $EXP2
+       else
+               EXP2=$test_dir/expect.2
+       fi
+fi
+
+if [ "$SKIP_GUNZIP" != "true" ] ; then
+       gunzip < $IMAGE > $TMPFILE
+fi
+
+cp /dev/null $OUT1
+
+eval $PREP_CMD
+
+echo 'stat /a' > $TMPFILE.cmd
+echo 'ex /zero' >> $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
+rm -rf $TMPFILE.cmd
+$TUNE2FS -O extent $TMPFILE >> $OUT1.new 2>&1
+$FSCK $FSCK_OPT -E bmap2extent -N test_filesys $TMPFILE >> $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
+rm -f $OUT1.new
+
+$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+status=$?
+echo Exit status is $status >> $OUT2.new
+echo 'ex /a' > $TMPFILE.cmd
+echo 'ex /zero' >> $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
+rm -rf $TMPFILE.cmd
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
+rm -f $OUT2.new
+
+eval $AFTER_CMD
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+       rm -f $test_name.ok $test_name.failed
+       cmp -s $OUT1 $EXP1
+       status1=$?
+       if [ "$ONE_PASS_ONLY" != "true" ]; then
+               cmp -s $OUT2 $EXP2
+               status2=$?
+       else
+               status2=0
+       fi
+       if [ "$PASS_ZERO" = "true" ]; then
+               cmp -s $test_name.0.log $test_dir/expect.0
+               status3=$?
+       else
+               status3=0
+       fi
+
+       if [ -z "$test_description" ] ; then
+               description="$test_name"
+       else
+               description="$test_name: $test_description"
+       fi
+
+       if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
+               echo "$description: ok"
+               touch $test_name.ok
+       else
+               echo "$description: failed"
+               rm -f $test_name.failed
+               if [ "$PASS_ZERO" = "true" ]; then
+                       diff $DIFF_OPTS $test_dir/expect.0 \
+                               $test_name.0.log >> $test_name.failed
+               fi
+               diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
+               if [ "$ONE_PASS_ONLY" != "true" ]; then
+                       diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
+               fi
+       fi
+       rm -f tmp_expect
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+       unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
+       unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
+       unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
+fi
+
diff --git a/tests/f_extent_too_deep/expect.1 b/tests/f_extent_too_deep/expect.1
new file mode 100644 (file)
index 0000000..a595482
--- /dev/null
@@ -0,0 +1,23 @@
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 7   1/  1     0 -     0    12              1
+ 1/ 7   1/  1     0 -     0    13              1
+ 2/ 7   1/  1     0 -     0    14              1
+ 3/ 7   1/  1     0 -     0    15              1
+ 4/ 7   1/  1     0 -     0    16              1
+ 5/ 7   1/  1     0 -     0    17              1
+ 6/ 7   1/  1     0 -     0     9              1
+ 7/ 7   1/  1     0 -     0    10 -    10      1 
+Pass 1: Checking inodes, blocks, and sizes
+Inode 12 extent tree could be more shallow (7; could be <= 4)
+Fix? yes
+
+Pass 1E: Optimizing extent trees
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 1
diff --git a/tests/f_extent_too_deep/expect.2 b/tests/f_extent_too_deep/expect.2
new file mode 100644 (file)
index 0000000..a1d28b1
--- /dev/null
@@ -0,0 +1,10 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/128 files (0.0% non-contiguous), 19/512 blocks
+Exit status is 0
+debugfs: ex /a
+Level Entries       Logical      Physical Length Flags
+ 0/ 0   1/  1     0 -     0    10 -    10      1 
diff --git a/tests/f_extent_too_deep/image.gz b/tests/f_extent_too_deep/image.gz
new file mode 100644 (file)
index 0000000..0f5adff
Binary files /dev/null and b/tests/f_extent_too_deep/image.gz differ
diff --git a/tests/f_extent_too_deep/name b/tests/f_extent_too_deep/name
new file mode 100644 (file)
index 0000000..7e8654a
--- /dev/null
@@ -0,0 +1 @@
+extent tree is deeper than it needs to be
diff --git a/tests/f_extent_too_deep/script b/tests/f_extent_too_deep/script
new file mode 100644 (file)
index 0000000..ee18438
--- /dev/null
@@ -0,0 +1,118 @@
+if [ "$DESCRIPTION"x != x ]; then
+       test_description="$DESCRIPTION"
+fi
+if [ "$IMAGE"x = x ]; then
+       IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+       FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+       SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+       OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+       OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+       if [ -f $test_dir/expect.1.gz ]; then
+               EXP1=$test_name.1.tmp
+               gunzip < $test_dir/expect.1.gz > $EXP1
+       else
+               EXP1=$test_dir/expect.1
+       fi
+fi
+
+if [ "$EXP2"x = x ]; then
+       if [ -f $test_dir/expect.2.gz ]; then
+               EXP2=$test_name.2.tmp
+               gunzip < $test_dir/expect.2.gz > $EXP2
+       else
+               EXP2=$test_dir/expect.2
+       fi
+fi
+
+if [ "$SKIP_GUNZIP" != "true" ] ; then
+       gunzip < $IMAGE > $TMPFILE
+fi
+
+cp /dev/null $OUT1
+
+eval $PREP_CMD
+
+echo 'ex /a' > $TMPFILE.cmd
+$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1
+rm -rf $TMPFILE.cmd
+$FSCK $FSCK_OPT  -N test_filesys $TMPFILE >> $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT1.new >> $OUT1
+rm -f $OUT1.new
+
+if [ "$ONE_PASS_ONLY" != "true" ]; then
+       $FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+       status=$?
+       echo Exit status is $status >> $OUT2.new
+       echo 'ex /a' > $TMPFILE.cmd
+       $DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1
+       rm -rf $TMPFILE.cmd
+       sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" $OUT2.new > $OUT2
+       rm -f $OUT2.new
+fi
+
+eval $AFTER_CMD
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+       rm -f $test_name.ok $test_name.failed
+       cmp -s $OUT1 $EXP1
+       status1=$?
+       if [ "$ONE_PASS_ONLY" != "true" ]; then
+               cmp -s $OUT2 $EXP2
+               status2=$?
+       else
+               status2=0
+       fi
+       if [ "$PASS_ZERO" = "true" ]; then
+               cmp -s $test_name.0.log $test_dir/expect.0
+               status3=$?
+       else
+               status3=0
+       fi
+
+       if [ -z "$test_description" ] ; then
+               description="$test_name"
+       else
+               description="$test_name: $test_description"
+       fi
+
+       if [ "$status1" -eq 0 -a "$status2" -eq 0 -a "$status3" -eq 0 ] ; then
+               echo "$description: ok"
+               touch $test_name.ok
+       else
+               echo "$description: failed"
+               rm -f $test_name.failed
+               if [ "$PASS_ZERO" = "true" ]; then
+                       diff $DIFF_OPTS $test_dir/expect.0 \
+                               $test_name.0.log >> $test_name.failed
+               fi
+               diff $DIFF_OPTS $EXP1 $OUT1 >> $test_name.failed
+               if [ "$ONE_PASS_ONLY" != "true" ]; then
+                       diff $DIFF_OPTS $EXP2 $OUT2 >> $test_name.failed
+               fi
+       fi
+       rm -f tmp_expect
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+       unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2 
+       unset SKIP_VERIFY SKIP_CLEANUP SKIP_GUNZIP ONE_PASS_ONLY PREP_CMD
+       unset DESCRIPTION SKIP_UNLINK AFTER_CMD PASS_ZERO
+fi
+
diff --git a/tests/f_opt_extent/expect b/tests/f_opt_extent/expect
new file mode 100644 (file)
index 0000000..6d4863b
--- /dev/null
@@ -0,0 +1,55 @@
+tune2fs metadata_csum test
+Creating filesystem with 524288 1k blocks and 65536 inodes
+Superblock backups stored on blocks: 
+       8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
+
+Allocating group tables:      \b\b\b\b\bdone                            
+Writing inode tables:      \b\b\b\b\bdone                            
+Creating journal (16384 blocks): done
+Creating 477 huge file(s) with 1024 blocks each: done
+Writing superblocks and filesystem accounting information:      \b\b\b\b\bdone
+
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+
+
+Change in FS metadata:
+@@ -10,7 +10,7 @@
+ Inode count:              65536
+ Block count:              524288
+ Reserved block count:     26214
+-Free blocks:              570
++Free blocks:              567
+ Free inodes:              65047
+ First block:              1
+ Block size:               1024
+@@ -47,8 +47,8 @@
+   Block bitmap at 262 (+261)
+   Inode bitmap at 278 (+277)
+   Inode table at 294-549 (+293)
+-  21 free blocks, 535 free inodes, 3 directories, 535 unused inodes
+-  Free blocks: 4414-4434
++  18 free blocks, 535 free inodes, 3 directories, 535 unused inodes
++  Free blocks: 4417-4434
+   Free inodes: 490-1024
+ Group 1: (Blocks 8193-16384) [INODE_UNINIT]
+   Backup superblock at 8193, Group descriptors at 8194-8197
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
diff --git a/tests/f_opt_extent/name b/tests/f_opt_extent/name
new file mode 100644 (file)
index 0000000..7d4389c
--- /dev/null
@@ -0,0 +1 @@
+optimize extent tree
diff --git a/tests/f_opt_extent/script b/tests/f_opt_extent/script
new file mode 100644 (file)
index 0000000..2da5e91
--- /dev/null
@@ -0,0 +1,64 @@
+FSCK_OPT=-fn
+OUT=$test_name.log
+EXP=$test_dir/expect
+CONF=$TMPFILE.conf
+
+cat > $CONF << ENDL
+[fs_types]
+       ext4h = {
+               features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,64bit,metadata_csum
+               blocksize = 1024
+               inode_size = 256
+               make_hugefiles = true
+               hugefiles_dir = /xyz
+               hugefiles_slack = 0
+               hugefiles_name = aaaaa
+               hugefiles_digits = 4
+               hugefiles_size = 1M
+               zero_hugefiles = false
+       }
+ENDL
+
+echo "tune2fs metadata_csum test" > $OUT
+
+MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
+rm -rf $CONF
+
+# dump and check
+$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+# check
+$FSCK -fyD -N test_filesys $TMPFILE >> $OUT 2>&1
+
+# dump and check
+$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
+echo "Change in FS metadata:" >> $OUT
+diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+rm $TMPFILE $OUT.before $OUT.after
+
+#
+# Do the verification
+#
+
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
+mv $OUT.new $OUT
+
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+       echo "$test_name: $test_description: ok"
+       touch $test_name.ok
+else
+       echo "$test_name: $test_description: failed"
+       diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+fi
+
+unset IMAGE FSCK_OPT OUT EXP CONF
diff --git a/tests/f_opt_extent_ext3/expect b/tests/f_opt_extent_ext3/expect
new file mode 100644 (file)
index 0000000..1761471
--- /dev/null
@@ -0,0 +1,44 @@
+rebuild extent metadata_csum test
+Creating filesystem with 524288 1k blocks and 65536 inodes
+Superblock backups stored on blocks: 
+       8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409
+
+Allocating group tables:      \b\b\b\b\bdone                            
+Writing inode tables:      \b\b\b\b\bdone                            
+Creating journal (16384 blocks): done
+mke2fs: Operation not supported for inodes containing extents while creating huge files
+Writing superblocks and filesystem accounting information:      \b\b\b\b\bdone
+
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 3A: Optimizing directories
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+
+
+Change in FS metadata:
+@@ -2,7 +2,7 @@
+ Last mounted on:          <not available>
+ Filesystem magic number:  0xEF53
+ Filesystem revision #:    1 (dynamic)
+-Filesystem features:      has_journal ext_attr resize_inode dir_index filetype sparse_super large_file huge_file dir_nlink
++Filesystem features:      has_journal ext_attr resize_inode dir_index filetype extent sparse_super large_file huge_file dir_nlink
+ Default mount options:    user_xattr acl
+ Filesystem state:         clean
+ Errors behavior:          Continue
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+Exit status is 0
diff --git a/tests/f_opt_extent_ext3/name b/tests/f_opt_extent_ext3/name
new file mode 100644 (file)
index 0000000..b369685
--- /dev/null
@@ -0,0 +1 @@
+convert ext3 to extent tree
diff --git a/tests/f_opt_extent_ext3/script b/tests/f_opt_extent_ext3/script
new file mode 100644 (file)
index 0000000..931eae7
--- /dev/null
@@ -0,0 +1,65 @@
+FSCK_OPT=-fn
+OUT=$test_name.log
+EXP=$test_dir/expect
+CONF=$TMPFILE.conf
+
+cat > $CONF << ENDL
+[fs_types]
+       ext4h = {
+               features = has_journal,^extent,huge_file,^flex_bg,^uninit_bg,dir_nlink,^extra_isize,sparse_super,filetype,dir_index,ext_attr,resize_inode,^64bit,^metadata_csum
+               blocksize = 1024
+               inode_size = 256
+               make_hugefiles = true
+               hugefiles_dir = /
+               num_hugefiles = 100
+               hugefiles_slack = 0
+               hugefiles_name = aaaaa
+               hugefiles_digits = 4
+               hugefiles_size = 1M
+               zero_hugefiles = false
+       }
+ENDL
+
+echo "rebuild extent metadata_csum test" > $OUT
+
+MKE2FS_CONFIG=$CONF $MKE2FS -F -T ext4h $TMPFILE 524288 >> $OUT 2>&1
+rm -rf $CONF
+
+# dump and check
+$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.before
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+# check
+$FSCK -fyD -N test_filesys -E bmap2extent $TMPFILE >> $OUT 2>&1
+
+# dump and check
+$DUMPE2FS $TMPFILE 2> /dev/null | grep '^Group 0:' -B99 -A20 | sed -f $cmd_dir/filter.sed > $OUT.after
+echo "Change in FS metadata:" >> $OUT
+diff -u $OUT.before $OUT.after | tail -n +3 >> $OUT
+$FSCK $FSCK_OPT -N test_filesys $TMPFILE >> $OUT 2>&1
+status=$?
+echo Exit status is $status >> $OUT
+
+rm $TMPFILE $OUT.before $OUT.after
+
+#
+# Do the verification
+#
+
+sed -f $cmd_dir/filter.sed -e "s;$TMPFILE;test.img;" -e 's/test_filesys:.*//g' < $OUT > $OUT.new
+mv $OUT.new $OUT
+
+cmp -s $OUT $EXP
+status=$?
+
+if [ "$status" = 0 ] ; then
+       echo "$test_name: $test_description: ok"
+       touch $test_name.ok
+else
+       echo "$test_name: $test_description: failed"
+       diff $DIFF_OPTS $EXP $OUT > $test_name.failed
+fi
+
+unset IMAGE FSCK_OPT OUT EXP CONF