diff mbox series

[blktests,4/5] common: Add _test_dev_is_partition() helper function

Message ID 20190220081231.15366-5-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Fix failures found with zoned block devices | expand

Commit Message

Shin'ichiro Kawasaki Feb. 20, 2019, 8:12 a.m. UTC
To control test conditions unique for partition devices, introduce the
_test_dev_is_partition() helper function. Refer TEST_DEV_PART_SYSFS
variable to tell if the TEST_DEV is a partition device or not.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
 common/rc | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Omar Sandoval March 4, 2019, 10:36 p.m. UTC | #1
On Wed, Feb 20, 2019 at 05:12:30PM +0900, Shin'ichiro Kawasaki wrote:
> To control test conditions unique for partition devices, introduce the
> _test_dev_is_partition() helper function. Refer TEST_DEV_PART_SYSFS
> variable to tell if the TEST_DEV is a partition device or not.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  common/rc | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index 153a323..0c354a2 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -208,6 +208,14 @@ _test_dev_in_hotplug_slot() {
>  	return 0
>  }
>  
> +_test_dev_is_partition() {
> +	if [[ -z ${TEST_DEV_PART_SYSFS} ]]; then
> +		SKIP_REASON="${TEST_DEV} is not a partition device"
> +		return 1
> +	fi
> +	return 0
> +}
> +
>  # Older versions of xfs_io use pwrite64 and such, so the error messages won't
>  # match current versions of xfs_io. See c52086226bc6 ("filter: xfs_io output
>  # has dropped "64" from error messages") in xfstests.
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 153a323..0c354a2 100644
--- a/common/rc
+++ b/common/rc
@@ -208,6 +208,14 @@  _test_dev_in_hotplug_slot() {
 	return 0
 }
 
+_test_dev_is_partition() {
+	if [[ -z ${TEST_DEV_PART_SYSFS} ]]; then
+		SKIP_REASON="${TEST_DEV} is not a partition device"
+		return 1
+	fi
+	return 0
+}
+
 # Older versions of xfs_io use pwrite64 and such, so the error messages won't
 # match current versions of xfs_io. See c52086226bc6 ("filter: xfs_io output
 # has dropped "64" from error messages") in xfstests.