diff mbox series

[blktests,v2,04/16] common: Introduce _have_fio_zbd_zonemode() helper function

Message ID 20190110093725.32675-5-shinichiro.kawasaki@wdc.com (mailing list archive)
State New, archived
Headers show
Series Implement zoned block device support | expand

Commit Message

Shinichiro Kawasaki Jan. 10, 2019, 9:37 a.m. UTC
Fio zbd zone mode is necessary for zoned block devices. Introduce the
helper function _have_fio_zbd_zonemode() to check that the installed
fio version supports the option --zonemode=zbd.

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

Comments

Omar Sandoval Jan. 17, 2019, 2:22 a.m. UTC | #1
On Thu, Jan 10, 2019 at 06:37:13PM +0900, Shin'ichiro Kawasaki wrote:
> Fio zbd zone mode is necessary for zoned block devices. Introduce the
> helper function _have_fio_zbd_zonemode() to check that the installed
> fio version supports the option --zonemode=zbd.

Testing version numbers is fragile. How about

if ! fio --cmdhelp=zonemode | grep -q zbd; then
	SKIP_REASON="Fio version too old (does not support --zonemode=zbd)"
	return 1
fi

> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
>  common/fio | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/common/fio b/common/fio
> index e407088..44d9c86 100644
> --- a/common/fio
> +++ b/common/fio
> @@ -17,6 +17,18 @@ _have_fio() {
>  	return 0
>  }
>  
> +_have_fio_zbd_zonemode() {
> +	local -a v
> +
> +	_have_fio || return $?
> +	mapfile -t v < <(fio --version | tr -s -c "[:digit:]" "\n")
> +	if [[ ${v[1]} -lt 3 || ( ${v[1]} -eq 3 && ${v[2]} -lt 9 ) ]]; then
> +		SKIP_REASON="Fio version too old (does not support --zonemode=zbd)"
> +		return 1
> +	fi
> +	return 0
> +}
> +
>  declare -A FIO_TERSE_FIELDS
>  FIO_TERSE_FIELDS=(
>  	# Read status
> -- 
> 2.20.1
>
Shinichiro Kawasaki Jan. 17, 2019, 6:21 a.m. UTC | #2
On 1/17/19 11:23 AM, Omar Sandoval wrote:
> On Thu, Jan 10, 2019 at 06:37:13PM +0900, Shin'ichiro Kawasaki wrote:
>> Fio zbd zone mode is necessary for zoned block devices. Introduce the
>> helper function _have_fio_zbd_zonemode() to check that the installed
>> fio version supports the option --zonemode=zbd.
> 
> Testing version numbers is fragile. How about
> 
> if ! fio --cmdhelp=zonemode | grep -q zbd; then
> 	SKIP_REASON="Fio version too old (does not support --zonemode=zbd)"
> 	return 1
> fi

OK. Will change as suggested. Thanks!
diff mbox series

Patch

diff --git a/common/fio b/common/fio
index e407088..44d9c86 100644
--- a/common/fio
+++ b/common/fio
@@ -17,6 +17,18 @@  _have_fio() {
 	return 0
 }
 
+_have_fio_zbd_zonemode() {
+	local -a v
+
+	_have_fio || return $?
+	mapfile -t v < <(fio --version | tr -s -c "[:digit:]" "\n")
+	if [[ ${v[1]} -lt 3 || ( ${v[1]} -eq 3 && ${v[2]} -lt 9 ) ]]; then
+		SKIP_REASON="Fio version too old (does not support --zonemode=zbd)"
+		return 1
+	fi
+	return 0
+}
+
 declare -A FIO_TERSE_FIELDS
 FIO_TERSE_FIELDS=(
 	# Read status