From 2f79cd18a9bcb125767aad24fe54effe889ea2e0 Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 21 Apr 2015 10:40:50 -0400 Subject: [PATCH] tests: verify rebuilding of sparse extent trees & block map file conversion Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- tests/f_collapse_extent_tree/expect.1 | 16 +++ tests/f_collapse_extent_tree/expect.2 | 10 ++ tests/f_collapse_extent_tree/image.gz | Bin 0 -> 2537 bytes tests/f_collapse_extent_tree/name | 1 + tests/f_collapse_extent_tree/script | 118 +++++++++++++++++++ tests/f_compress_extent_tree_level/expect.1 | 23 ++++ tests/f_compress_extent_tree_level/expect.2 | 17 +++ tests/f_compress_extent_tree_level/image.gz | Bin 0 -> 2581 bytes tests/f_compress_extent_tree_level/name | 1 + tests/f_compress_extent_tree_level/script | 118 +++++++++++++++++++ tests/f_convert_bmap/expect.1 | 26 +++++ tests/f_convert_bmap/expect.2 | 10 ++ tests/f_convert_bmap/image.gz | Bin 0 -> 3548 bytes tests/f_convert_bmap/name | 1 + tests/f_convert_bmap/script | 117 +++++++++++++++++++ tests/f_convert_bmap_and_extent/expect.1 | 33 ++++++ tests/f_convert_bmap_and_extent/expect.2 | 16 +++ tests/f_convert_bmap_and_extent/image.gz | Bin 0 -> 3657 bytes tests/f_convert_bmap_and_extent/name | 1 + tests/f_convert_bmap_and_extent/script | 119 ++++++++++++++++++++ tests/f_extent_too_deep/expect.1 | 23 ++++ tests/f_extent_too_deep/expect.2 | 10 ++ tests/f_extent_too_deep/image.gz | Bin 0 -> 2592 bytes tests/f_extent_too_deep/name | 1 + tests/f_extent_too_deep/script | 118 +++++++++++++++++++ tests/f_opt_extent/expect | 55 +++++++++ tests/f_opt_extent/name | 1 + tests/f_opt_extent/script | 64 +++++++++++ tests/f_opt_extent_ext3/expect | 44 ++++++++ tests/f_opt_extent_ext3/name | 1 + tests/f_opt_extent_ext3/script | 65 +++++++++++ 31 files changed, 1009 insertions(+) create mode 100644 tests/f_collapse_extent_tree/expect.1 create mode 100644 tests/f_collapse_extent_tree/expect.2 create mode 100644 tests/f_collapse_extent_tree/image.gz create mode 100644 tests/f_collapse_extent_tree/name create mode 100644 tests/f_collapse_extent_tree/script create mode 100644 tests/f_compress_extent_tree_level/expect.1 create mode 100644 tests/f_compress_extent_tree_level/expect.2 create mode 100644 tests/f_compress_extent_tree_level/image.gz create mode 100644 tests/f_compress_extent_tree_level/name create mode 100644 tests/f_compress_extent_tree_level/script create mode 100644 tests/f_convert_bmap/expect.1 create mode 100644 tests/f_convert_bmap/expect.2 create mode 100644 tests/f_convert_bmap/image.gz create mode 100644 tests/f_convert_bmap/name create mode 100644 tests/f_convert_bmap/script create mode 100644 tests/f_convert_bmap_and_extent/expect.1 create mode 100644 tests/f_convert_bmap_and_extent/expect.2 create mode 100644 tests/f_convert_bmap_and_extent/image.gz create mode 100644 tests/f_convert_bmap_and_extent/name create mode 100644 tests/f_convert_bmap_and_extent/script create mode 100644 tests/f_extent_too_deep/expect.1 create mode 100644 tests/f_extent_too_deep/expect.2 create mode 100644 tests/f_extent_too_deep/image.gz create mode 100644 tests/f_extent_too_deep/name create mode 100644 tests/f_extent_too_deep/script create mode 100644 tests/f_opt_extent/expect create mode 100644 tests/f_opt_extent/name create mode 100644 tests/f_opt_extent/script create mode 100644 tests/f_opt_extent_ext3/expect create mode 100644 tests/f_opt_extent_ext3/name create mode 100644 tests/f_opt_extent_ext3/script diff --git a/tests/f_collapse_extent_tree/expect.1 b/tests/f_collapse_extent_tree/expect.1 new file mode 100644 index 000000000..e2eb65e0a --- /dev/null +++ b/tests/f_collapse_extent_tree/expect.1 @@ -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 index 000000000..a1d28b1bd --- /dev/null +++ b/tests/f_collapse_extent_tree/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), 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 index 0000000000000000000000000000000000000000..97036cc597c5d2bcf6da6ffa68039b743b46aa20 GIT binary patch literal 2537 zc-oWi=3r2~7aqdI{Pxc7?BGBdh6lxY##=IfImEQ^-3nbX`9VZ0->#??lNCe@FW4FQ z#YVL}TII*Z*HrHjAfO&wvUze}my@ja$2)hVrIT2)v*+IzulqiySl;uUviknXEiDW( zp{IYUa6fd>vO6yD>gk^~J=eHSyKdZJX8c#hmFMiUr|S)uTs`cRwf(*Jw5JI-Ev9#g zzx10H^z+x-+1&PezM@Y`c&Bzwh4l(H_VvIMHLp0;CiE@B>MS|I7>!P`z@O+~JZtInS?V zY5Ws6Sbx6lQT_khUl;cMDsYzt*?RnOeLDjI;8eV1H7}5sv9e=iWFQ+PXp3D-TXwr} z%D3OAf0{_@eyiWuljIryB7f>%#bueLwryU=%QkL3_N{m6j-MuaPcPc>uX9T<*IB>B zGkKHyfBDn@-rwgf+xl4k*Zz0k71LSE+?CJQt5rX(kFYZ+7A0@u$V=M)tuk|PwoF{<@!HmdK?U+U=)mk ZQ7{Td!6={&IB@MRi^H5(=NK3i7yv$J5j+3@ literal 0 Hc-jL100001 diff --git a/tests/f_collapse_extent_tree/name b/tests/f_collapse_extent_tree/name new file mode 100644 index 000000000..83e506fca --- /dev/null +++ b/tests/f_collapse_extent_tree/name @@ -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 index 000000000..ee184389c --- /dev/null +++ b/tests/f_collapse_extent_tree/script @@ -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 index 000000000..1159f24d5 --- /dev/null +++ b/tests/f_compress_extent_tree_level/expect.1 @@ -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 index 000000000..07d108294 --- /dev/null +++ b/tests/f_compress_extent_tree_level/expect.2 @@ -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 index 0000000000000000000000000000000000000000..a552a586ce20e4fbc01d6f332ec800c5c5b6011f GIT binary patch literal 2581 zc-oWi=3rR!C_IFT`RyHR9}!0hh6gkEYCmX@`O&3zM1osdIA^Jlw(gQiEytLI4n?Hq`jLtg`|b&q_WGat95BG-FN>tx4!HeqZ_jr)RIH>*?If{BP|Sv-8%k+sAkPd2;YL_u=Paa{ab8 z7R65wT$X5aDi6&4{msJ6yZ%?_>ox0_zxZ;6nIVCD%G3ArMBKw){||e0eSc1N>&EnR z0t^fcIrZA@uO9}lJ$3)OSwS^W;KBazx_|d&lMDq`Wi#$_4&>npx&GlDckiQ5TVJnz zJo$QFjI93l)(@*BAG_wy2C6@>?b21V|Nk$ndG;T~;D?%w!ErlJY8es>VHl>$fVeA<|6&)!J6Nm)mR<D}LSoa$9=_>>%fi*XFe#i{4n=V`O9?8$2jKqubNB=4hVPyYl6i7j3ut_fzKT zw5S&mxzT&&<$M=tw zZvFb$|JeR-|DEMTf0)mk{`LHYs;}{aeNTR=uL=Htr8vj!@8+rN|GPi^VJ>#~5C7MA zp7i~z|96$_iFe;{?#{QRFV0o^%RN>Dhs>j6D{p;Tf2BTk%KrMbVk``!U=)mkQ7{Td V!6={&c<{ZJ?O6YMSq26L1^^~uEpY$< literal 0 Hc-jL100001 diff --git a/tests/f_compress_extent_tree_level/name b/tests/f_compress_extent_tree_level/name new file mode 100644 index 000000000..fde4f4ad4 --- /dev/null +++ b/tests/f_compress_extent_tree_level/name @@ -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 index 000000000..ee184389c --- /dev/null +++ b/tests/f_compress_extent_tree_level/script @@ -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 index 000000000..7d2ca86e9 --- /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 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 index 000000000..632d411e0 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..7c22532397ba8d42e928f75190dc545cae2140cf GIT binary patch literal 3548 zc-rmM+fP#m00!`GMv(#XU_iwcHi?%kK|n5z)q=)|I<2Bep$7^B28Dx#8LgFerI}Nd zD4?JqAP`~L8|NH}RJ2fVHbR&nL)%kr%f%rS&!Ke44wur)vh2l&Wv|;qe-Gb3@O}9L zuC69sTueCm=?e3(dmCqh^ki0O5g@ZU^=>|!eUKy4YhLA7wry%WRJ;niRR7E2dl$oF z!z=Dy-&tI~qvGc38$0)vfBCf(7meI+OJ`nLWm)LJMe{VC<;);Wy-+9AQF9y8NR#nl z2ex{6s`G-j-`U~$Dyejs|6@FxqR;E`GH`Z*r*7YVJ*jVH8t4|Ak#0)Kd%KeznH?Gx z<>}UDe5c8Xq)q)+Qbt|=wTV)5S_@Vg=PijmL?s?|B!xMnS%PPU9mcau+FEmgaZ+%E zYQ?;&HrQ2hy=_FM zEAYL<82=!Y>J52;YQ4mt;f);71meeuDgC2JDLwZA{|G0g3<|
7+a^|49XwfG?g zm-e{+ghBI=(C`6H!ZC!cnJ4=B40G%tY|@k};>^h%8kjKZp>v2y>rdGDd(BLNc0_SZ zbwB0gGFlj+nn%{@4r9&SJp+;|?GM~oa&jtw3@Dvomxv4By@bF7wtl$~9yQK<#>Ayn2v7BgBBfRnwqANSr&OZ>?fdIrt{jg>9U;CtX+B{Tsp0e2ZK zx4;P{8#*CJK`x@?K`FT!AvmD4Or2lhs{FsNys>D>F<0=7^{>-vFUWCpWR0hxvx711 zf}T5BNOd?qcl|(5(VK<}Tlf8!A$|#_>2Ppnd@SDmQDFb>Z`YI0b3Tj?Iy2Pi?Q^{R zrQjE$b|LwLGz#~U{>9h}iZmvGOKqN%FI^tm+PFr2VaAW-;^N}s;^Oi@HIwD|Y-!V~ JAQI^d(x2jsflB}Y literal 0 Hc-jL100001 diff --git a/tests/f_convert_bmap/name b/tests/f_convert_bmap/name new file mode 100644 index 000000000..67e0d4760 --- /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 000000000..f6b6f622b --- /dev/null +++ b/tests/f_convert_bmap/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 +$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 index 000000000..7af91aa3e --- /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 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 index 000000000..73765eaa7 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..916b493c710843030b453b548be0b6adcd12c48d GIT binary patch literal 3657 zc-rmK?N?Lx0l;z8Q(3Kpb*>^Hu%1KZY=R&(GJ`-ZLr%v*o$At9i}sx1(XH8)qnLx!<}_bvp~AAuV}cFwk!JA1tsd|rJ2 zf^R_e&)k%Cb(GCptkdsz=L5I22|Og&+PhEw26=waJIH!{^7q z>jL@V&Lh9N8WI>-PPqovNjd}X{$h4@-P~}H{L{I>wEP$;chELtU$>75?5>I-$564} zVUF76R;}O-a}&33b^r7r_lMjt?dvB=URn7~vu8_-p9@}jznvT3?frF)waoftBORSK|$H#$E8IsW3W)! z%h+FT_6^nXMVF46mhOKM#L$5shHYG8{$XL{^c7bMs(-)BUFkRPzuE0yE=CP?bad#B@FNercJ-`J{#2$C&g=^QwyI+NfFLZKeDC$c zwfXt4y?0a$_rA!*<_~wB9G`f3FK^}Ju5n} zu9kkff4wsP;aA*EyIdESJpWs!J_<&jGd1<{Ja#{AkShC#-AwDJ$}`w7O=pym*pTKJ zM8^#pj-949s>==0>`SKh1Bx1UttPXO7QyN=4J^>@a))szoHwmrU>-w^a8mR){#l+1 zcQg*W3l|nku+uQtn(iD4xXVFtJ5(*peMsK88+23>>WQ@*Q=M=5eGg>d?sj*p#-SJhHUVZ$Px_bRmp~f z;Cq51(CDFY0}o6PIfB8#6lPl}asyu@{vd$&$v(iF2pTuHfjCSDBeKE5%cWbf@qSlxS&m$%cZkr(jqL$cG^v?O)SKQ$K1x9`!v7j}oqeo*1*F((pjs}8xz-NR9v zx=$KT!n|qiLb@FaVU1{*(?dN9h~2>dEV|vF;;9lD;@FcWRgc;aI}U#tJ>Z`zZj)fC zaA~y0KV1ybu@abVrAFXO;Ic{An3b#uLep7dQ&%Ic9C^mFnOc`2C(A|trjao&+k)Q$ zZDg5;Dvm{s)_Oq0tgt%0tRS=j8w2%xwho$Mv>Ku?35TUq&d^(t*PxMK zEJ?K~?dUB~N#qJ-F*yP9F6PD7p%+ z6D)d)moXl|n!Z8C4MQZ>03f1F(7F#A!L%G6J=LtVp`Mrs+#^bye-qMTm3wgo!E-hV zvxgK)9OWcATU3zQXv6FrI-OY|i#1BIDx%ccT+}vXG-Ear)e@?Ac#icSx8M5USlx03 zS`f9XqSA6kJGbxDi~27t>dM_dgO5r~u2W97N0kM;qZ5T(*nMd4Chlckf@f6_qv67c z)Ab~GVsf?E_O5urRkVKSWol*ABi^t@I_5%_%=5WOLvW;EMSCKIK4LgyZqEr}?lt@c zPJ?okQ;#fC*W5}hr_bdZy#Ho-wPon)gA=tb-dg03Yp0SF-;}<2tJ%}%#F)fcz&W{SJelFf5!kOoT&nNtj-RH#Zj+bkz5nerKl&v0n78>r# z(VBBN51p-kY&Gh4gr5#8Y5eQtn-y27)9rsaGZ!{+bZ*fkN#D8ywdPz1D?!FTnI^ey b*sx*4h7BA3PfdNdw#9zmVRUo*wc9@dUE{jk literal 0 Hc-jL100001 diff --git a/tests/f_convert_bmap_and_extent/name b/tests/f_convert_bmap_and_extent/name new file mode 100644 index 000000000..c9394c62b --- /dev/null +++ b/tests/f_convert_bmap_and_extent/name @@ -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 index 000000000..203ab25c4 --- /dev/null +++ b/tests/f_convert_bmap_and_extent/script @@ -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 index 000000000..a595482f1 --- /dev/null +++ b/tests/f_extent_too_deep/expect.1 @@ -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 index 000000000..a1d28b1bd --- /dev/null +++ b/tests/f_extent_too_deep/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), 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 index 0000000000000000000000000000000000000000..0f5adff562c7f45f275a4401344e784b6c61ef0b GIT binary patch literal 2592 zc-oWi=3wx?6duCF{PymCf8jtGh7aG@g)R_rT-?mre9>1}CPu>N$ctAhoXss6N_=iF z5@Jgn)7j0{g?;~U$MjrWSXgN2BJ`haZVz)`*522$TUX9#P_RGs-1*+#-}m|t)ke$R z5APFT+7Par(yh|6IP<$^TY&yHb=Pd!4HL>YcLz^?KYf{6a)z0HeXpXe&6y>)!{oHZ z{w4_aEWdmEi{rbce>>ZI-7k9*+V6{hzqYV7kNLxZgT@4xk?M^bd2d}j)Ap48L(^!o=nzNt^b-j@Bn z(tB&}&(}Bi3E1%+uQ+>K4XAm;YM!#Q|M&Ag|6C8`EjZre0W^eR#(!oY`RqRf1RN+^ zrE}asvi|tZEY;kb`&rhAeT=#WvTSblx-e^XZm6;iyPtml|33e?a}X1dXKMxYT_3*( zCy@Q+#h?9m`r4PW0NGU~|KhWbE5p?I-}>mN2{KD=?*HRuHVUdh;S0sHV(UNL2dnNY zcVHkNMD))*y7J`IZPVBNKK--Aa8msLoQt1qmtMI4>bJAc^r=rJPRTw$dQDK;eAYJp zbhWsY+^3ZvvRJkqI`p^X;*5yYKmA94e1Ffj`_Yf-AJ_kWJ|UfTo160LdbP0C|0fl! zSy6vT>#P6HjM;(zbDn?y|M~aN9VWls|B7$kQgXGv_U-3YvdK|fUrg@%8g#rW_vO1E qQLpx|Nu6K6RE&jT6pVsVFbYP&C>RB_0SSNW7%!$}&S79sU;qH{0yvof literal 0 Hc-jL100001 diff --git a/tests/f_extent_too_deep/name b/tests/f_extent_too_deep/name new file mode 100644 index 000000000..7e8654acc --- /dev/null +++ b/tests/f_extent_too_deep/name @@ -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 index 000000000..ee184389c --- /dev/null +++ b/tests/f_extent_too_deep/script @@ -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 index 000000000..6d4863b51 --- /dev/null +++ b/tests/f_opt_extent/expect @@ -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: done +Writing inode tables: done +Creating journal (16384 blocks): done +Creating 477 huge file(s) with 1024 blocks each: done +Writing superblocks and filesystem accounting information: done + +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 index 000000000..7d4389cc5 --- /dev/null +++ b/tests/f_opt_extent/name @@ -0,0 +1 @@ +optimize extent tree diff --git a/tests/f_opt_extent/script b/tests/f_opt_extent/script new file mode 100644 index 000000000..2da5e919d --- /dev/null +++ b/tests/f_opt_extent/script @@ -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 index 000000000..176147150 --- /dev/null +++ b/tests/f_opt_extent_ext3/expect @@ -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: done +Writing inode tables: done +Creating journal (16384 blocks): done +mke2fs: Operation not supported for inodes containing extents while creating huge files +Writing superblocks and filesystem accounting information: done + +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: + 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 index 000000000..b36968511 --- /dev/null +++ b/tests/f_opt_extent_ext3/name @@ -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 index 000000000..931eae778 --- /dev/null +++ b/tests/f_opt_extent_ext3/script @@ -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 -- 2.47.2