diff mbox

[5/5] btrfs: misc-test: Add regression test for find-root gives empty result

Message ID 1456124397-21403-6-git-send-email-quwenruo@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Qu Wenruo Feb. 22, 2016, 6:59 a.m. UTC
Add regression test for btrfs-find-root gives empty result even the fs
is OK.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 .../first_meta_chunk.btrfs-image                    | Bin 0 -> 4096 bytes
 tests/misc-tests/012-find-root-no-result/test.sh    |  20 ++++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image
 create mode 100644 tests/misc-tests/012-find-root-no-result/test.sh
diff mbox

Patch

diff --git a/tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image b/tests/misc-tests/012-find-root-no-result/first_meta_chunk.btrfs-image
new file mode 100644
index 0000000000000000000000000000000000000000..7bf6c50916f68ed00dae7627e848a91abf5455bb
GIT binary patch
literal 4096
zcmeH}doa}NAIGsQmda)AQE~}Ity*QRZLQcu=&WiZ6l<v*_p^n~ZBwar&8AK3-f}Wl
zn<%$(S-VP-TUeKJZKVw%k<BIh!<;|P^!xp0&Oc}7H^1pK&wQTue4b}MpU?A}@AsJ}
z!7Jqgf4ggq*q<i7I*YH5RiU)1#5i2VwYBgyce!p|m#yoTb-izWPwTqY0jw=>Hm`Zm
zT3n2yw&wS*>oxV$eiHae;D3lf=vz4tvI6I_G|}vcg0qnKG;F%tzx=vT`LU|1Dwm&l
zY#~&S$|xNUb(c-000fdb^0r&8Q5JKLui7G*TFq#n_)U;L@UhyJ+sKX4N}H3BiK-BI
zDrdtrk7@#LFe&y|#|m>6UC%HQ<cFx6TYL#r@}7$Yyw;tU+!<iRmDN?T(~q<!cASyu
zh}9h@T-(jv)|f${X@*KCUOjFIvgYcmO6hFciUb6{jpssbZFU<-I1wR^>~{*OZBlge
z-LbiY;#jj&ovF$GF$dF!W4(-?XA#+ebabWZrc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<ESS4p(i$kq`QfWt6n84^icE}|k<N5-Bn;ZuSkrZWfy
ztXP5~G>V-7knx>G6EA+gAYI|=Uxe+dxO*}UH~^>ejWx*hXq44!tJhd<=FvyzH5wZC
zA}GrL`3QeIdg)w^i(C5r-$jn2OSESOZGFpc5^m2cCgLRjc8Y&wBj@6PxG<e;@Q)<_
Mne-=t|1Sdn0?V+~RR910

literal 0
HcmV?d00001

diff --git a/tests/misc-tests/012-find-root-no-result/test.sh b/tests/misc-tests/012-find-root-no-result/test.sh
new file mode 100644
index 0000000..4951633
--- /dev/null
+++ b/tests/misc-tests/012-find-root-no-result/test.sh
@@ -0,0 +1,20 @@ 
+#!/bin/bash
+# Regression test for case btrfs-find-root may print no result on a
+# recent fs or balanced fs, whose metadata chunk is the first chunk
+# and the only metadata chunk
+
+source $TOP/tests/common
+
+check_prereq btrfs-find-root
+check_prereq btrfs-image
+
+$TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \
+	_fail "failed to extract first_meta_chunk.btrfs-image"
+
+result=$($TOP/btrfs-find-root test.img | sed '/^Superblock/d')
+
+if [ -z "$result" ]; then
+	_fail "btrfs-find-root failed to find tree root"
+fi
+
+rm test.img