public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: Eryu Guan <guaneryu@gmail.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] common/rc: Check more options for filefrag command
Date: Fri, 23 Nov 2018 13:18:13 +0800	[thread overview]
Message-ID: <5BF78D95.4050207@cn.fujitsu.com> (raw)
In-Reply-To: <20181123051251.GJ3889@desktop>

Hi Eryu,

Thanks for your comment.
Your idea seems better to me, and i will send a v2 patch.  :-)

Best Regards,
Xiao Yang
On 2018/11/23 13:12, Eryu Guan wrote:

> On Tue, Nov 20, 2018 at 04:41:08PM +0800, Xiao Yang wrote:
>> In generic/519, filefrag command use FIBMAP ioctl(-B option) to print
>> output in extent format(-e option) on purpose and sync file(-s option),
>> so check if the command supports all of these options by _require_filefrag_options().
>>
>> Rename _require_fibmap() to _require_filefrag_options()
>> Also remove duplicate _require_command "$FILEFRAG_PROG" filefrag
>>
>> References:
>> 1) filefrag supports -e option by commit 2508eaa since v1.42.7.
>> 2) filefrag supports -B option by commit 5d5e01d since v1.41.9.
>> 3) filefrag supports -s option by commit e62847c since v1.41.6.
>>
>> Signed-off-by: Xiao Yang<yangx.jy@cn.fujitsu.com>
>> ---
>>   common/rc         | 12 +++++++-----
>>   tests/generic/519 |  3 +--
>>   2 files changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/common/rc b/common/rc
>> index ecb1738..5a11359 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -3843,17 +3843,19 @@ _require_scratch_btime()
>>   	_scratch_unmount
>>   }
>>
>> -_require_fibmap()
>> +_require_filefrag_options()
>>   {
>>   	_require_command "$FILEFRAG_PROG" filefrag
>>
>> -	local file="$TEST_DIR/fibmap_testfile"
>> +	local options=$1
>> +	local file="$TEST_DIR/testfile"
>>
>>   	echo "XX">  $file
>> -	${FILEFRAG_PROG} -B $file 2>&1 | grep -q "FIBMAP[[:space:]]*unsupported"
>> -	if [ $? -eq 0 ]; then
>> +	local output=`${FILEFRAG_PROG} $options $file 2>&1`
>> +	echo $output | grep -q "FIBMAP[[:space:]]*unsupported"&&  \
>>   		_notrun "FIBMAP not supported by this filesystem"
> I think we'd better to split the FIBMAP check from the other options
> check. e.g. keep the _require_fibmap() function, but require needed
> options first there.
>
> _require_fibmap()
> {
> 	_require_filefrag_options "B"
> 	<other FIBMAP checks>
> }
>
>> -	fi
>> +	echo $output | grep -q "invalid option"&&  \
>> +		_notrun "filefrag doesn't support $options option"
>>   	rm -f $file
>>   }
>>
>> diff --git a/tests/generic/519 b/tests/generic/519
>> index 229c5b4..ccc15d4 100755
>> --- a/tests/generic/519
>> +++ b/tests/generic/519
>> @@ -33,8 +33,7 @@ rm -f $seqres.full
>>   _supported_fs generic
>>   _supported_os Linux
>>   _require_scratch
>> -_require_command "$FILEFRAG_PROG" filefrag
>> -_require_fibmap
>> +_require_filefrag_options "-Bes"
> And we require fibmap and other needed options in the test, e.g.
>
> _require_fibmap
> _require_filefrag_options "es"
>
> Note that no "-" in the required options.
>
> Thanks,
> Eryu
>
>>
>>   testfile="$SCRATCH_MNT/$seq-testfile"
>>
>> -- 
>> 1.8.3.1
>>
>>
>>
>
>

  reply	other threads:[~2018-11-23 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20  8:41 [PATCH] common/rc: Check more options for filefrag command Xiao Yang
2018-11-23  5:12 ` Eryu Guan
2018-11-23  5:18   ` Xiao Yang [this message]
2018-11-23  5:24   ` [PATCH v2] common/rc: Add _require_filefrag_options() to check options for filefrag Xiao Yang
2018-11-26 21:50     ` Dave Chinner
2018-11-27  2:47       ` Xiao Yang
2018-11-29  1:55         ` Dave Chinner

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=5BF78D95.4050207@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox