Message ID | 20180327070658.13064-10-lufq.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 2018年03月27日 15:06, Lu Fengqi wrote: > The testcase checks the functionality of "btrfs rescue undelete-subvol", > including recovering an intact subvolume, and handling correctly > incomplete subvolume. > > Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> > --- > v2: add shell quoting to test script. > > .../030-undelete-subvol/deleted_subvolume.img | Bin 0 -> 4096 bytes > .../030-undelete-subvol/drop_progress.raw.xz | Bin 0 -> 23452 bytes 030 is already taken. And just a nitpick, the file name is not obvious for its content. In fact for "drop_progress", it have 2 orphan roots while only one can be recovered. For "deleted_subvolume" it has 1 orphan root and it can be recovered. Despite that, it looks good to me. Thanks, Qu > tests/misc-tests/030-undelete-subvol/test.sh | 34 +++++++++++++++++++++ > 3 files changed, 34 insertions(+) > create mode 100644 tests/misc-tests/030-undelete-subvol/deleted_subvolume.img > create mode 100644 tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz > create mode 100755 tests/misc-tests/030-undelete-subvol/test.sh > > diff --git a/tests/misc-tests/030-undelete-subvol/deleted_subvolume.img b/tests/misc-tests/030-undelete-subvol/deleted_subvolume.img > new file mode 100644 > index 0000000000000000000000000000000000000000..9168a8e33fbbb14f9ea78514721a52191b94d1a0 > GIT binary patch > literal 4096 > zcmeH|do+|=AIB%x8p^0djl0}JQb@$O%TY$;lEx)vlF+ymV;WO45{D?%IqnhB$S}Fi > zjN6EihKkC4NQhyKaT(V$2k-mO={@KF_pD{Fy}r-)`R-@^*504B_p@W+PlCQF!fF8j > zZGs!m9b0|F@NPJOvGJw?_&4=#{gw~i3;@(EFS(@+TiUf5-~Erz<=ODYja#|MmTnGi > zw`~I31pbc*g!Km3O1HeZD~KRV`{Pj~uzt<!(k&GKVR-=o%Mv|>3r2&j3Mv|UgTH}a > zWDkSP-%;<0K6oq%LMk0=5)g}2I{;`k(RwtnGuI_hB01WRSAongy!#b`_p*d$38#+; > zcYI;9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zdY>o!34x- > zf=~s)a%m<7<=N$mEk3g{K0aS)5Q~o%4<x&sXGY_N+Hsb3S)-Yphz`_@A*S9yO-7{A > zYQBQoFFhvh0X-TkNY8+hCRNwn{k<HIh8#&^(dI|jPa{8~3N7DTQsk!GRra-)%F7T= > z20Fx*h7a@QQ97Te92F>(9R>QL7W2uspH*KopFWYyiKEB0WdA*o`T(uUGBdW_&Hk*E > zzTw9jeaVG?gtI%=*AAzOt@~-PogS@pC<cvNndN*@;PVNLs(gipI;+<=K4);D{ZsHy > ZeM(;pZJdD++rKZroo*A@Ch+ek@Fx_v;e7xA > > literal 0 > HcmV?d00001 > > diff --git a/tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz b/tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz > new file mode 100644 > index 0000000000000000000000000000000000000000..3db2c80e61fa9bb99db374509dbb95910965d467 > GIT binary patch > literal 23452 > zcmeHPXH=63mktC7z4zV}r8hyO7ZF71J@gJj=p6y+(xijbKnNWvN|D}+^dbU^sPx_m > zAee9V?4CV)c4qg}`DSLFv-y{QZ{GXfd!PF}w_J((=^Fw77^^d{6wv`JX!HO8fOt%Q > z7>Rs>(P<0-IA0-=um<EkDJ2RwF>{T^q#LWS2+;ZNGGoXTU+*0WG?kjb!RY9Rd@zE! > zprWN%HWIB*2GqTt(O<mJ>QjR79XdXGC|eojjqRj@Ntje7V=&Dfp58RkEphE+!*iK3 > ze=gkgvO#(Wb3wy1yH#b!yCt$!YIsJE^$1(}*0xh|G%dc{X8vwN4zHQ}bVmsR<s^;p > zo1FQ@#en!Cnsw{>RrWRKCJQwJZ4r;|fIzaNqWP$xtDSB^E`4R#+kNfF<kDzNG(HMk > z-Pu^-_90d6FamaI%>#ZlImmLpgm-*(wek`j)@7COOkP^)r&;tzG%wF$uJ>jkzy^dj > z*q1CnCUcRGf<3#$dF~&$F~=`u6%?zfjrjSgZ#=WTN%JruO&XD64@f4|;_Itq@hv`` > znjt?-*%=Zcor6q8k0n~uoI_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7T7$Y%EEQ(Ii396!N#IuRe2E`62y~$vXVlxU-An{F(7f#O`rH*c > zWhZAC@G*?%ig>WTQEIkA(C-~Qa2v=_zre<+qd2f6JEwnGc|C77@58*ef5|N?tj>lW > z{uBCUk8=9t>R~~l^z2!a+~=MB=XQfE3fb+IB#KNq?E3@Atp^<)qN*!k^5@YyEQJ#u > zwUK}EJjfrzsDF#D7C+LAM6pE_TST$NpNuV{+Ulsb`mYBA{}>=ZH9b*H&%dJSNsPw* > zuT4n?;C%HR+WbErVEnDJ>7P#U{&1kmE`{2o3Nch6hAPBRh1h=?H~(oSB)(_L9938R > zuDap@niOEmLc|w=w0c>^k84}^@Xjkm(Y^KPaVE#-m1U9X)H*I^9xn`J0MF`Z40Xgl > zw-!k0S_di}k9+8bW@A8xTj$oJE7N(9yjz+7WU=IjVd-bvCipcN6Qy$*p@8#;fwT0N > z!HTWikEBa{6mY3)!9oMr<LaK={O`NewG&y>v4Ez7F5=`Jf}$C43N-jS42N^O3~6}1 > z!VRA?sklw-|KpgL{*!Gll%xHyqoIThl#qcEGJdLMJXA=cLJ}2{sF3{6rDhb%{9l&w > z|Mr{-MazE|Ek~gw3MEk}`IDjKFAXJ+{@WD04FQ!#LEm{z<!_(Be=T}_#|;_xR@%yc > zlPmtk7TkB=tohqoIRdaIXbCJbn+%eEU-ust^SFBnD8Vv}{Egc@f7|!`6K=um!J4a3 > zk{C)7Lp3c?O-oeM^80SP{q6AsMJG{o@~@d5L*3Z>&hvh#kVJ(fDkOixvzI6h5v3vi > znHplSXfpr=*mesVH2U-k5T7H4`*6nj769$I9xXUHSmu|z+cKE}>*Q48{J>v+127B> > F{{akY3)=ty > > literal 0 > HcmV?d00001 > > diff --git a/tests/misc-tests/030-undelete-subvol/test.sh b/tests/misc-tests/030-undelete-subvol/test.sh > new file mode 100755 > index 000000000000..d3dfa5008601 > --- /dev/null > +++ b/tests/misc-tests/030-undelete-subvol/test.sh > @@ -0,0 +1,34 @@ > +#!/bin/bash > +# Test undelete-subvol can recover the intact subvolume, and can skip the > +# incomplete subvolume. > + > +source "$TOP/tests/common" > + > +check_prereq btrfs > +check_prereq btrfs-image > + > +setup_root_helper > + > +check_image() > +{ > + TEST_DEV="$1" > + > + run_check_stdout "$TOP/btrfs" rescue undelete-subvol "$TEST_DEV" \ > + | grep -q "Recovered 1 subvols" \ > + || _fail "failed to undelete subvol $image" >&2 > + > + run_check "$TOP/btrfs" check "$TEST_DEV" > + > + # check whether the recovered image can be mounted normally > + run_check_mount_test_dev > + > + run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume list "$TEST_MNT" \ > + | grep -q "lost+found" \ > + || _fail "failed to find the recovered subvol $image" >&2 > + > + run_check_umount_test_dev "$TEST_MNT" > + > + rm "$TEST_DEV" > +} > + > +check_all_images >
On 04/18/2018 01:42 PM, Qu Wenruo wrote: > > > On 2018年03月27日 15:06, Lu Fengqi wrote: >> The testcase checks the functionality of "btrfs rescue undelete-subvol", >> including recovering an intact subvolume, and handling correctly >> incomplete subvolume. >> >> Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> >> --- >> v2: add shell quoting to test script. >> >> .../030-undelete-subvol/deleted_subvolume.img | Bin 0 -> 4096 bytes >> .../030-undelete-subvol/drop_progress.raw.xz | Bin 0 -> 23452 bytes > > 030 is already taken. > > And just a nitpick, the file name is not obvious for its content. > In fact for "drop_progress", it have 2 orphan roots while only one can > be recovered. > For "deleted_subvolume" it has 1 orphan root and it can be recovered. > > Despite that, it looks good to me. I am ashamed of the bad image naming. And I have renamed the images, add your above description to test.sh.
diff --git a/tests/misc-tests/030-undelete-subvol/deleted_subvolume.img b/tests/misc-tests/030-undelete-subvol/deleted_subvolume.img new file mode 100644 index 0000000000000000000000000000000000000000..9168a8e33fbbb14f9ea78514721a52191b94d1a0 GIT binary patch literal 4096 zcmeH|do+|=AIB%x8p^0djl0}JQb@$O%TY$;lEx)vlF+ymV;WO45{D?%IqnhB$S}Fi zjN6EihKkC4NQhyKaT(V$2k-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hw)G=a^_UGlEFuf?-JGn zrt3Oz*O1f$_uqL2)&V~`vD^hS#j3mRtrVnrHk6fM)Az8Q5M9FVc;SjPt^dWinLHEw z(Yd%niJ8}8Uk@IFxs`OJKq)!4{LOe!xf<W3<4#vGp4<HE^uZfWJHLYEy_k`g&X>}C zCCb1~=m9Lg$9ZHABR*mWv80B!dG3fdJeMV!XUBJIiz)c*3_^%D@4@C+zdY>o!34x- zf=~s)a%m<7<=N$mEk3g{K0aS)5Q~o%4<x&sXGY_N+Hsb3S)-Yphz`_@A*S9yO-7{A zYQBQoFFhvh0X-TkNY8+hCRNwn{k<HIh8#&^(dI|jPa{8~3N7DTQsk!GRra-)%F7T= z20Fx*h7a@QQ97Te92F>(9R>QL7W2uspH*KopFWYyiKEB0WdA*o`T(uUGBdW_&Hk*E zzTw9jeaVG?gtI%=*AAzOt@~-PogS@pC<cvNndN*@;PVNLs(gipI;+<=K4);D{ZsHy ZeM(;pZJdD++rKZroo*A@Ch+ek@Fx_v;e7xA literal 0 HcmV?d00001 diff --git a/tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz b/tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz new file mode 100644 index 0000000000000000000000000000000000000000..3db2c80e61fa9bb99db374509dbb95910965d467 GIT binary patch literal 23452 zcmeHPXH=63mktC7z4zV}r8hyO7ZF71J@gJj=p6y+(xijbKnNWvN|D}+^dbU^sPx_m zAee9V?4CV)c4qg}`DSLFv-y{QZ{GXfd!PF}w_J((=^Fw77^^d{6wv`JX!HO8fOt%Q z7>Rs>(P<0-IA0-=um<EkDJ2RwF>{T^q#LWS2+;ZNGGoXTU+*0WG?kjb!RY9Rd@zE! zprWN%HWIB*2GqTt(O<mJ>QjR79XdXGC|eojjqRj@Ntje7V=&Dfp58RkEphE+!*iK3 ze=gkgvO#(Wb3wy1yH#b!yCt$!YIsJE^$1(}*0xh|G%dc{X8vwN4zHQ}bVmsR<s^;p zo1FQ@#en!Cnsw{>RrWRKCJQwJZ4r;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 100755 index 000000000000..d3dfa5008601 --- /dev/null +++ b/tests/misc-tests/030-undelete-subvol/test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Test undelete-subvol can recover the intact subvolume, and can skip the +# incomplete subvolume. + +source "$TOP/tests/common" + +check_prereq btrfs +check_prereq btrfs-image + +setup_root_helper + +check_image() +{ + TEST_DEV="$1" + + run_check_stdout "$TOP/btrfs" rescue undelete-subvol "$TEST_DEV" \ + | grep -q "Recovered 1 subvols" \ + || _fail "failed to undelete subvol $image" >&2 + + run_check "$TOP/btrfs" check "$TEST_DEV" + + # check whether the recovered image can be mounted normally + run_check_mount_test_dev + + run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume list "$TEST_MNT" \ + | grep -q "lost+found" \ + || _fail "failed to find the recovered subvol $image" >&2 + + run_check_umount_test_dev "$TEST_MNT" + + rm "$TEST_DEV" +} + +check_all_images
The testcase checks the functionality of "btrfs rescue undelete-subvol", including recovering an intact subvolume, and handling correctly incomplete subvolume. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> --- v2: add shell quoting to test script. .../030-undelete-subvol/deleted_subvolume.img | Bin 0 -> 4096 bytes .../030-undelete-subvol/drop_progress.raw.xz | Bin 0 -> 23452 bytes tests/misc-tests/030-undelete-subvol/test.sh | 34 +++++++++++++++++++++ 3 files changed, 34 insertions(+) create mode 100644 tests/misc-tests/030-undelete-subvol/deleted_subvolume.img create mode 100644 tests/misc-tests/030-undelete-subvol/drop_progress.raw.xz create mode 100755 tests/misc-tests/030-undelete-subvol/test.sh