diff mbox

[1/2] btrfs-progs: test/fsck: Introduce test images containing tree reloc tree

Message ID 20171031060758.531-1-wqu@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Qu Wenruo Oct. 31, 2017, 6:07 a.m. UTC
Tree reloc tree is a special tree with very short life spawn.
It acts as a special snapshot for any tree, with related nodes/leaves or
EXTENT_DATA modified to point to new position.

Considering the short life spawn and its specialness, it should be quite
reasonable to keep them as both corner case for fsck and educational
dump for anyone interested in relocation.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/fsck-tests/027-tree-reloc-tree/test.sh       |  22 +++++++++++++++++++++
 .../tree_reloc_for_data_reloc.img.xz               | Bin 0 -> 2112 bytes
 .../tree_reloc_for_fs_tree.img.xz                  | Bin 0 -> 2424 bytes
 3 files changed, 22 insertions(+)
 create mode 100755 tests/fsck-tests/027-tree-reloc-tree/test.sh
 create mode 100644 tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_data_reloc.img.xz
 create mode 100644 tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_fs_tree.img.xz

diff --git a/tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_data_reloc.img.xz b/tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_data_reloc.img.xz
new file mode 100644
index 0000000000000000000000000000000000000000..66d8bde6b7a6c451eb7b3b6f4dbc6a919144d1f5
GIT binary patch
literal 2112
zcmV-G2*3CJH+ooF000E$*0e?f03iV!0000G&sfah5B~@LT>wRyj;C3^v%$$4d1r37
zhA1@4w_z}05@xu}qhN$h#=9A)MD}#c5t`w0DAA1ZzCzD>FO393JL%KESo(OESm)Se
zsSi<fk1&FCIL@@NUjW5Ebwu6XC4FDjWKDaa&o(6@a#0MMUA!Vwr1A~J(~l?#_7j*B
zO_?sPLqUSKF&0jR+QZbuF-Ds*@PjOt$W<Q`t_zudGClp;ebvF*@`*|lw~$A3y}53v
z&T8?s)?}TJHIOSY)L5)6Ep!m450tlqS$3u`;ZyCP)a9O0ZHYZo@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e6u!1A2o}ie`#F_
zujRnW7#<I_D{KJGCvN9GsnE^JH6|VGBU_-{)PYzZ+lZJPEb6Jobo<^ja<APBKSf0g
zQcSH<Y^@72e>+)7e1Q3B+W&}hLVHMZ5iyc_4ZQX_bo>HSYux!aa$l|@xkv>#xedMW
zh?74dkLXz7Tk0EWJGP6}1@wM<kc607@c@SKM0F5xy$%;6F)B`*c1bvUNj1H90<@;2
zX;pYtik{rF2j_ZFLw(@p|B)&<SRUYpr$*e5qr@^WhC^lzyE&2_^UDf!vat;S1)R9o
qz8l~G0000xQ$56T;#K+p0h$niAOHZNhFr?A#Ao{g000001X)^_7Zf!B

literal 0
HcmV?d00001

diff --git a/tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_fs_tree.img.xz b/tests/fsck-tests/027-tree-reloc-tree/tree_reloc_for_fs_tree.img.xz
new file mode 100644
index 0000000000000000000000000000000000000000..22af324b95f61902ef6d3afa4b4930b7de3da41f
GIT binary patch
literal 2424
zcmV-;35WLmH+ooF000E$*0e?f03iV!0000G&sfah5B~``T>wRyj;C3^v%$$4d1wdA
zhA1@4FQtHC5@xu}qhN$h#=9A)MD}kZJDsuMAcn@)`6EaApWd{S>8%BnWfF=649R^9
zhSZ!gBqxWUwRV^Y$&R=6HvdFxjTEunmCftkc^4dvZx8UWdfa;I$XeqG<I!TA0-95N
z-@o?wwnVvt>d=1wHkb}6SL5fgModV(X}^PDMLC`~!Xt2yMwUQ})L|d-^i&C7B3IJ5
z*~l)NLguNp5_68vyjw>C8TZ$&70X186PlPn3FTje$fYuAl%pIkC`C!YRFZN;2uv*L
z*g&Ef)!<(YoZXwp2!7ezH0wp>Mzz$h+MSK+WsjcmF^jE`o}Gwn6qMmzjIkZ3#Qs>E
zW0GvL>i-bM81TB}z+v33!pPDo&+)!M1uMq+M$^M<Gf9^7gtIX-!xyim90|$sj^nAr
zWOQiKJlAaF_)gBG-(~~vb9o{0d__Zdl%)-;EHR-ijA$W)7v`Gtheb}fNBu^mG%SLu
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%U<6n8`=Wl
z<@@e&)X(DzAK_r4>rCusa3FAHP1RlJUiXKXf>SW$ZCoaS7LzhqWg)P3rV@RG9CYbj
z40OUClLron{+0{yE2`~FCq6dfRP9iv7_jJVQ*W1Y$tv<_GYx{Q#o79Nz8o)9@|LB}
zmzF@^Z4e|=I-syv+@4Y52qZe`tjWW5tIfafMX|P48}MD?xwF()Vd8z&3nR?|d%{{4
zXfB6VH|J!Bx!?TIzAbPPAQIozd@ul*mLA$NvZ<NBQrOQ3VJ#D)Om0w>FgPio{1u0b
z#J@%axw$uQnn9%+MnN`yP<KaXRsH+ih7KqfXeY|WdX$$|Cm#s*s|C^W+uGhs3+JIQ
z+rJHgigT)$-V_0~zi(cPBf<#k0^T(7`h56NA4^c_x_Qp_Cv<vq$%Low;t85nz7X#>
zGrsJUEyJ5gEY}sM9U53ypK^=V@_d_GaaW^`UtGa`^k!uVDYn^A>Jy^g|MWU&@8Y>i
q({C&aU;qHT8fD3z4oMRL0n`$JAOHZ}zRrcQ#Ao{g000001X)`3eYNEP

literal 0
HcmV?d00001

Comments

David Sterba Nov. 9, 2017, 5:03 p.m. UTC | #1
On Tue, Oct 31, 2017 at 02:07:57PM +0800, Qu Wenruo wrote:
> +++ b/tests/fsck-tests/027-tree-reloc-tree/test.sh
> @@ -0,0 +1,22 @@
> +#!/bin/bash
> +# Make sure btrfs check won't report any false alert for valid image with
> +# tree reloc tree.
> +#
> +# Also due to the short life spawn of tree reloc tree, save them as dump
> +# example for later usage.
> +
> +source "$TOP/tests/common"
> +
> +check_prereq btrfs
> +
> +for img in *.img.xz
> +do
> +	image=$(extract_image "$img")
> +	run_check_stdout "$TOP/btrfs" check "$image" 2>&1 |
> +		grep -q "Errors found in extent allocation tree or chunk allocation"
> +	if [ $? -eq 0 ]; then
> +		rm -f "$image"
> +		_fail "unexpected error occurred when checking $img"
> +	fi
> +	rm -f "$image"
> +done

Please use the test script pattern with the redefinition of check_image
and followed by check_all_images. An example is in
fsck-tests/022-qgroup-rescan-halfway. If you copied that from
fsck-tests/020-extent-ref-cases, then this is a good candidate for a
cleanup. Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/fsck-tests/027-tree-reloc-tree/test.sh b/tests/fsck-tests/027-tree-reloc-tree/test.sh
new file mode 100755
index 000000000000..559c4bc700bd
--- /dev/null
+++ b/tests/fsck-tests/027-tree-reloc-tree/test.sh
@@ -0,0 +1,22 @@ 
+#!/bin/bash
+# Make sure btrfs check won't report any false alert for valid image with
+# tree reloc tree.
+#
+# Also due to the short life spawn of tree reloc tree, save them as dump
+# example for later usage.
+
+source "$TOP/tests/common"
+
+check_prereq btrfs
+
+for img in *.img.xz
+do
+	image=$(extract_image "$img")
+	run_check_stdout "$TOP/btrfs" check "$image" 2>&1 |
+		grep -q "Errors found in extent allocation tree or chunk allocation"
+	if [ $? -eq 0 ]; then
+		rm -f "$image"
+		_fail "unexpected error occurred when checking $img"
+	fi
+	rm -f "$image"
+done