All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 5/5] btrfs-progs: misc-test: Add regression test for find-root gives empty result
Date: Thu, 25 Feb 2016 08:36:57 +0800	[thread overview]
Message-ID: <56CE4CA9.6080106@cn.fujitsu.com> (raw)
In-Reply-To: <20160224121051.GB23746@twin.jikos.cz>



David Sterba wrote on 2016/02/24 13:10 +0100:
> On Mon, Feb 22, 2016 at 02:59:57PM +0800, Qu Wenruo wrote:
>> 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
>
> Applied with following fixups:
>
> --- a/tests/misc-tests/012-find-root-no-result/test.sh
> +++ b/tests/misc-tests/012-find-root-no-result/test.sh
> @@ -8,13 +8,17 @@ source $TOP/tests/common
>   check_prereq btrfs-find-root
>   check_prereq btrfs-image
>
> -$TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \
> +run_check $TOP/btrfs-image -r first_meta_chunk.btrfs-image test.img || \
>          _fail "failed to extract first_meta_chunk.btrfs-image"
>

Thanks, I just forget that we have run_check suffix to handle errors.

> -result=$($TOP/btrfs-find-root test.img | sed '/^Superblock/d')
> +result=$(run_check_stdout $TOP/btrfs-find-root test.img | sed '/^Superblock/d')
>
>   if [ -z "$result" ]; then
>          _fail "btrfs-find-root failed to find tree root"
>   fi
>
> +if ! echo "$result" | grep -q 'Found tree root at'; then
> +       _fail "btrfs-find-root failed to find tree root, unexpected output"
> +fi
> +
Right, if btrfs-find-root failed to find the tree root matches with 
superblock, it's also a bug.

Thanks,
Qu
>   rm test.img
>
>
>



  reply	other threads:[~2016-02-25  0:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  6:59 [PATCH 0/5] btrfs-find-root enhancement for chunk tree corrupted fs Qu Wenruo
2016-02-22  6:59 ` [PATCH 1/5] btrfs-progs: volume: Fix a bug causing btrfs-find-root to skip first chunk Qu Wenruo
2016-02-22  6:59 ` [PATCH 2/5] btrfs-progs: Allow open_ctree to return fs_info even chunk tree is corrupted Qu Wenruo
2016-02-22  6:59 ` [PATCH 3/5] btrfs-progs: Add support for tree block operations on fs_info without roots Qu Wenruo
2016-02-22  6:59 ` [PATCH 4/5] btrfs-progs: find-root: Allow btrfs-find-root to search chunk root even chunk root is corrupted Qu Wenruo
2016-02-22  6:59 ` [PATCH 5/5] btrfs-progs: misc-test: Add regression test for find-root gives empty result Qu Wenruo
2016-02-24 12:10   ` David Sterba
2016-02-25  0:36     ` Qu Wenruo [this message]
2016-02-22  7:24 ` [PATCH 0/5] btrfs-find-root enhancement for chunk tree corrupted fs Qu Wenruo
2016-02-24 12:38 ` David Sterba
2016-02-25  0:37   ` Qu Wenruo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56CE4CA9.6080106@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.