public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Eryu Guan <eguan@redhat.com>
To: Xiao Yang <yangx.jy@cn.fujitsu.com>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] common/rc: update _require_dm_target() helper
Date: Tue, 21 Nov 2017 14:07:14 +0800	[thread overview]
Message-ID: <20171121060714.GM2749@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1511236671-5835-1-git-send-email-yangx.jy@cn.fujitsu.com>

On Tue, Nov 21, 2017 at 11:57:51AM +0800, Xiao Yang wrote:
> 1) generic/459 should be skipped when dm_snapshot is not supported.
> 2) update _require_dm_target() to handle multiple dm targets
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  common/dmhugedisk            |  3 +--
>  common/rc                    | 16 ++++++++--------
>  doc/requirement-checking.txt |  6 +++---
>  tests/generic/459            |  2 +-
>  4 files changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/common/dmhugedisk b/common/dmhugedisk
> index 4d3b63f..1c116c2 100644
> --- a/common/dmhugedisk
> +++ b/common/dmhugedisk
> @@ -23,8 +23,7 @@
>  
>  _require_dmhugedisk()
>  {
> -	_require_dm_target zero
> -	_require_dm_target snapshot
> +	_require_dm_target zero snapshot
>  }
>  
>  _dmhugedisk_init()
> diff --git a/common/rc b/common/rc
> index 4c053a5..6fe0ce9 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1782,23 +1782,23 @@ _require_sane_bdev_flush()
>  	fi
>  }
>  
> -# this test requires a specific device mapper target
> +# this test requires specific device mapper targets
>  _require_dm_target()
>  {
> -	_target=$1
> -
>  	# require SCRATCH_DEV to be a valid block device with sane BLKFLSBUF
>  	# behaviour
>  	_require_block_device $SCRATCH_DEV
>  	_require_sane_bdev_flush $SCRATCH_DEV
>  	_require_command "$DMSETUP_PROG" dmsetup
>  
> -	modprobe dm-$_target >/dev/null 2>&1
> +	for _target in "$@"; do
> +		modprobe dm-$_target >/dev/null 2>&1
>  
> -	$DMSETUP_PROG targets 2>&1 | grep -q ^$_target
> -	if [ $? -ne 0 ]; then
> -		_notrun "This test requires dm $_target support"
> -	fi
> +		$DMSETUP_PROG targets 2>&1 | grep -q ^$_target
> +		if [ $? -ne 0 ]; then
> +			_notrun "This test requires dm $_target support"
> +		fi
> +	done
>  }
>  
>  # this test requires the ext4 kernel support crc feature on scratch device
> diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
> index 4e01b1f..e27aacd 100644
> --- a/doc/requirement-checking.txt
> +++ b/doc/requirement-checking.txt
> @@ -112,10 +112,10 @@ _require_statx
>  DEVICE MAPPER REQUIREMENTS
>  ==========================
>  
> -_require_dm_target <name>
> +_require_dm_target <name1> <name2> ...
>  
> -     The test requires the use of the device mapper target and will be skipped
> -     if it isn't available in the kernel.
> +     The test requires the use of the device mapper targets and will be skipped
> +     if any one isn't available in the kernel.
>  
>  _require_log_writes
>  
> diff --git a/tests/generic/459 b/tests/generic/459
> index d1ad372..e3ac374 100755
> --- a/tests/generic/459
> +++ b/tests/generic/459
> @@ -61,7 +61,7 @@ _cleanup()
>  _supported_fs generic
>  _supported_os Linux
>  _require_scratch_nocheck
> -_require_dm_target thin-pool
> +_require_dm_target thin-pool snapshot

Hmm, why not just add another "_require_dm_target snapshot"? That's much
simpler to do and keeps the helper simple too. (We may add parameters
support to _require_dm_target in the future, there're already patches
trying to do so, I think keeping it simple avoids future conflicts and
complexity too).

Thanks,
Eryu

>  _require_command $LVM_PROG lvm
>  _require_command "$THIN_CHECK_PROG" thin_check
>  _require_freeze
> -- 
> 1.8.3.1
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2017-11-21  6:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21  3:57 [PATCH] common/rc: update _require_dm_target() helper Xiao Yang
2017-11-21  6:07 ` Eryu Guan [this message]
2017-11-21  6:20   ` Xiao Yang
2017-11-21  6:27   ` [PATCH v2] generic/459: add check for dm-snapshot target Xiao Yang

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=20171121060714.GM2749@eguan.usersys.redhat.com \
    --to=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=yangx.jy@cn.fujitsu.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