diff options
Diffstat (limited to '')
-rw-r--r-- | tests/f_convert_bmap/expect.1 | 26 | ||||
-rw-r--r-- | tests/f_convert_bmap/expect.2 | 10 | ||||
-rw-r--r-- | tests/f_convert_bmap/image.gz | bin | 0 -> 3548 bytes | |||
-rw-r--r-- | tests/f_convert_bmap/name | 1 | ||||
-rw-r--r-- | tests/f_convert_bmap/script | 115 | ||||
-rw-r--r-- | tests/f_convert_bmap_and_extent/expect.1 | 33 | ||||
-rw-r--r-- | tests/f_convert_bmap_and_extent/expect.2 | 16 | ||||
-rw-r--r-- | tests/f_convert_bmap_and_extent/image.gz | bin | 0 -> 3657 bytes | |||
-rw-r--r-- | tests/f_convert_bmap_and_extent/name | 1 | ||||
-rw-r--r-- | tests/f_convert_bmap_and_extent/script | 117 | ||||
-rw-r--r-- | tests/f_convert_bmap_sparse/expect.1 | 24 | ||||
-rw-r--r-- | tests/f_convert_bmap_sparse/expect.2 | 12 | ||||
-rw-r--r-- | tests/f_convert_bmap_sparse/image.gz | bin | 0 -> 5585 bytes | |||
-rw-r--r-- | tests/f_convert_bmap_sparse/name | 1 | ||||
-rw-r--r-- | tests/f_convert_bmap_sparse/script | 115 |
15 files changed, 471 insertions, 0 deletions
diff --git a/tests/f_convert_bmap/expect.1 b/tests/f_convert_bmap/expect.1 new file mode 100644 index 0000000..716dbcb --- /dev/null +++ b/tests/f_convert_bmap/expect.1 @@ -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 +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 0 diff --git a/tests/f_convert_bmap/expect.2 b/tests/f_convert_bmap/expect.2 new file mode 100644 index 0000000..632d411 --- /dev/null +++ b/tests/f_convert_bmap/expect.2 @@ -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 Binary files differnew file mode 100644 index 0000000..7c22532 --- /dev/null +++ b/tests/f_convert_bmap/image.gz diff --git a/tests/f_convert_bmap/name b/tests/f_convert_bmap/name new file mode 100644 index 0000000..67e0d47 --- /dev/null +++ b/tests/f_convert_bmap/name @@ -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 index 0000000..960a2f8 --- /dev/null +++ b/tests/f_convert_bmap/script @@ -0,0 +1,115 @@ +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 -f $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 $OUT1.new > $OUT1 + +$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 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 +rm -f $TMPFILE.cmd $OUT1.new $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 index 0000000..eafd64a --- /dev/null +++ b/tests/f_convert_bmap_and_extent/expect.1 @@ -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 +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 0 diff --git a/tests/f_convert_bmap_and_extent/expect.2 b/tests/f_convert_bmap_and_extent/expect.2 new file mode 100644 index 0000000..73765ea --- /dev/null +++ b/tests/f_convert_bmap_and_extent/expect.2 @@ -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 Binary files differnew file mode 100644 index 0000000..916b493 --- /dev/null +++ b/tests/f_convert_bmap_and_extent/image.gz diff --git a/tests/f_convert_bmap_and_extent/name b/tests/f_convert_bmap_and_extent/name new file mode 100644 index 0000000..1a58794 --- /dev/null +++ b/tests/f_convert_bmap_and_extent/name @@ -0,0 +1 @@ +convert blockmap 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 index 0000000..f61c8e2 --- /dev/null +++ b/tests/f_convert_bmap_and_extent/script @@ -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 +echo 'ex /zero' >> $TMPFILE.cmd +$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1 +rm -f $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 $OUT1.new > $OUT1 + +$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 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 +rm -f $TMPFILE.cmd $OUT1.new $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_sparse/expect.1 b/tests/f_convert_bmap_sparse/expect.1 new file mode 100644 index 0000000..095fb2b --- /dev/null +++ b/tests/f_convert_bmap_sparse/expect.1 @@ -0,0 +1,24 @@ +debugfs: stat /realmode.bin +Inode: 12 Type: regular Mode: 0775 Flags: 0x0 +Generation: 2022334337 Version: 0x00000001 +User: 1000 Group: 1000 Size: 21080 +File ACL: 0 +Links: 1 Blockcount: 16 +Fragment: Address: 0 Number: 0 Size: 0 +ctime: 0x5924849d -- Tue May 23 18:51:09 2017 +atime: 0x59247d36 -- Tue May 23 18:19:34 2017 +mtime: 0x591e1764 -- Thu May 18 21:51:32 2017 +BLOCKS: +(0):513, (4-8):514-518, (IND):58, (20):2005 +TOTAL: 8 + +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/256 files (8.3% non-contiguous), 65/2048 blocks +Exit status is 0 diff --git a/tests/f_convert_bmap_sparse/expect.2 b/tests/f_convert_bmap_sparse/expect.2 new file mode 100644 index 0000000..e5a3d44 --- /dev/null +++ b/tests/f_convert_bmap_sparse/expect.2 @@ -0,0 +1,12 @@ +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/256 files (8.3% non-contiguous), 65/2048 blocks +Exit status is 0 +debugfs: ex /realmode.bin +Level Entries Logical Physical Length Flags + 0/ 0 1/ 3 0 - 0 513 - 513 1 + 0/ 0 2/ 3 4 - 8 514 - 518 5 + 0/ 0 3/ 3 20 - 20 2005 - 2005 1 diff --git a/tests/f_convert_bmap_sparse/image.gz b/tests/f_convert_bmap_sparse/image.gz Binary files differnew file mode 100644 index 0000000..1f594fd --- /dev/null +++ b/tests/f_convert_bmap_sparse/image.gz diff --git a/tests/f_convert_bmap_sparse/name b/tests/f_convert_bmap_sparse/name new file mode 100644 index 0000000..dc3b985 --- /dev/null +++ b/tests/f_convert_bmap_sparse/name @@ -0,0 +1 @@ +convert sparse blockmap file to extents file diff --git a/tests/f_convert_bmap_sparse/script b/tests/f_convert_bmap_sparse/script new file mode 100644 index 0000000..e78a4bd --- /dev/null +++ b/tests/f_convert_bmap_sparse/script @@ -0,0 +1,115 @@ +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 /realmode.bin' > $TMPFILE.cmd +$DEBUGFS -f $TMPFILE.cmd $TMPFILE > $OUT1.new 2>&1 +rm -f $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 $OUT1.new > $OUT1 + +$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 +status=$? +echo Exit status is $status >> $OUT2.new +echo 'ex /realmode.bin' > $TMPFILE.cmd +$DEBUGFS -f $TMPFILE.cmd $TMPFILE >> $OUT2.new 2>&1 +sed -f $cmd_dir/filter.sed $OUT2.new > $OUT2 +rm -f $TMPFILE.cmd $OUT1.new $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 + |