All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Marcos Paulo de Souza <mpdesouza@suse.de>,
	Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Cc: dsterba@suse.com, linux-btrfs@vger.kernel.org,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	wqu@suse.com
Subject: Re: [btrfs-progs PATCH 4/4] tests: Do not fail is dmsetup is missing
Date: Wed, 18 Dec 2019 08:48:21 +0800	[thread overview]
Message-ID: <a880c99c-982d-135c-4e6e-e82c19e681c1@gmx.com> (raw)
In-Reply-To: <65eb6792b6c9e1c8f58a741866305a6ccb9fee32.camel@suse.de>


[-- Attachment #1.1: Type: text/plain, Size: 3240 bytes --]



On 2019/12/18 上午8:44, Marcos Paulo de Souza wrote:
> On Wed, 2019-12-18 at 08:30 +0800, Qu Wenruo wrote:
>>
>> On 2019/12/18 上午4:31, Marcos Paulo de Souza wrote:
>>> From: Marcos Paulo de Souza <mpdesouza@suse.com>
>>>
>>> Move the check of dmsetup to check_dm_target_support, and adapt the
>> only
>>> two places checking if dmsetup is present in the system. Now we
>> skip the
>>> test if dmsetup isn't available, instead of marking the test as
>> failed.
>>>
>>> Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
>>
>> Looks good overall, just a small nitpick inlined below.
>>
>>> ---
>>>  tests/common                                             | 9
>> +++++++--
>>>  tests/mkfs-tests/005-long-device-name-for-ssd/test.sh    | 1 -
>>>  .../017-small-backing-size-thin-provision-device/test.sh | 1 -
>>>  3 files changed, 7 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/tests/common b/tests/common
>>> index f138b17e..dc2d084e 100644
>>> --- a/tests/common
>>> +++ b/tests/common
>>> @@ -322,10 +322,15 @@ check_global_prereq()
>>>  	fi
>>>  }
>>>  
>>> -# check if the targets passed as arguments are available, and if
>> not just skip
>>> -# the test
>>> +# check if dmsetup and targets passed as arguments are available,
>> and skip the
>>> +# test if they aren't.
>>>  check_dm_target_support()
>>>  {
>>> +	which dmsetup &> /dev/null
>>> +	if [ $? -ne 0 ]; then
>>> +		_not_run "This test requires dmsetup tool.";
>>> +	fi
>>
>> What about using existing check_global_prereq()?
> 
> check_global_prereq call _fail when the executable is not found in
> $PATH, that's why I open coded the implementation and just called
> _not_run.

Makes sense.

Although it would be even better to change from "_fail" to "_not_run"
for check_global_prereq().
That could be a new patch.

Thanks,
Qu

> 
>>
>> Despite that,
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>>
>> Thanks,
>> Qu
>>
>>> +
>>>  	for target in "$@"; do
>>>  		$SUDO_HELPER modprobe dm-$target >/dev/null 2>&1
>>>  		$SUDO_HELPER dmsetup targets 2>&1 | grep -q ^$target
>>> diff --git a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
>> b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
>>> index 329deaf2..2df88db4 100755
>>> --- a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
>>> +++ b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
>>> @@ -4,7 +4,6 @@
>>>  source "$TEST_TOP/common"
>>>  
>>>  check_prereq mkfs.btrfs
>>> -check_global_prereq dmsetup
>>>  check_dm_target_support linear
>>>  
>>>  setup_root_helper
>>> diff --git a/tests/mkfs-tests/017-small-backing-size-thin-
>> provision-device/test.sh b/tests/mkfs-tests/017-small-backing-size-
>> thin-provision-device/test.sh
>>> index 91851945..83f34ecc 100755
>>> --- a/tests/mkfs-tests/017-small-backing-size-thin-provision-
>> device/test.sh
>>> +++ b/tests/mkfs-tests/017-small-backing-size-thin-provision-
>> device/test.sh
>>> @@ -6,7 +6,6 @@ source "$TEST_TOP/common"
>>>  
>>>  check_prereq mkfs.btrfs
>>>  check_global_prereq udevadm
>>> -check_global_prereq dmsetup
>>>  check_dm_target_support linear thin
>>>  
>>>  setup_root_helper
>>>
>>
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 520 bytes --]

  reply	other threads:[~2019-12-18  0:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 20:31 [btrfs-progs PATCH 0/4] tests: do not fail if dm-thin is missing Marcos Paulo de Souza
2019-12-17 20:31 ` [btrfs-progs PATCH 1/4] tests: common: Add check_dm_target_support helper Marcos Paulo de Souza
2019-12-18  0:26   ` Qu Wenruo
2019-12-18 15:58     ` David Sterba
2019-12-18 16:05       ` Marcos Paulo de Souza
2019-12-17 20:31 ` [btrfs-progs PATCH 2/4] tests: mkfs: 017: Use " Marcos Paulo de Souza
2019-12-18  0:26   ` Qu Wenruo
2019-12-17 20:31 ` [btrfs-progs PATCH 3/4] tests: mkfs: 005: " Marcos Paulo de Souza
2019-12-18  0:27   ` Qu Wenruo
2019-12-17 20:31 ` [btrfs-progs PATCH 4/4] tests: Do not fail is dmsetup is missing Marcos Paulo de Souza
2019-12-18  0:30   ` Qu Wenruo
2019-12-18  0:44     ` Marcos Paulo de Souza
2019-12-18  0:48       ` Qu Wenruo [this message]
2019-12-18 16:03         ` David Sterba

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=a880c99c-982d-135c-4e6e-e82c19e681c1@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=marcos.souza.org@gmail.com \
    --cc=mpdesouza@suse.com \
    --cc=mpdesouza@suse.de \
    --cc=wqu@suse.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 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.