Re: [PATCH v3 24/38] t/zbd: add run-tests-against-nullb script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jan 07, 2021 / 06:57, Dmitry Fomichev wrote:
> This script combines the t/zbd/run-tests-against-zoned-nullb script
> functionality with t/zbd/run-tests-against-regular-nullb and adds
> more zoned device configurations to test. This considerably improves
> ZBD test coverage.
> 
> The added script makes the two old scripts named above obsolete,
> remove them. Modify t/run-fio-tests.py and Makefile to refer to the
> new script instead of the old one. Since the full test now runs
> significantly longer than the two old ones combined due to many more
> zoned configurations, only execute a few individual sections as a
> part of testing n "make fulltest" and run-fio-tests.py. One extra test
> section with 10% conventional zones is executed from the Makefile.
> The Python tests only exercise all-conventional and all-sequential
> configurations, exactly as before.
> 
> The script returns a non-zero return code if at least one of the
> executed sections had a failed test.
> 
> Signed-off-by: Dmitry Fomichev <dmitry.fomichev@xxxxxxx>
> ---
>  Makefile                              |   5 +-
>  t/run-fio-tests.py                    |   8 +-
>  t/zbd/run-tests-against-nullb         | 338 ++++++++++++++++++++++++++
>  t/zbd/run-tests-against-regular-nullb |  27 --
>  t/zbd/run-tests-against-zoned-nullb   |  53 ----
>  5 files changed, 345 insertions(+), 86 deletions(-)
>  create mode 100755 t/zbd/run-tests-against-nullb
>  delete mode 100755 t/zbd/run-tests-against-regular-nullb
>  delete mode 100755 t/zbd/run-tests-against-zoned-nullb
> 
> diff --git a/Makefile b/Makefile
> index a838af9a..19bfb996 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -600,9 +600,10 @@ fulltest:
>  	   make -j &&						 	\
>  	   sudo make install)						\
>  	fi &&					 			\
> -	sudo t/zbd/run-tests-against-regular-nullb &&		 	\
> +	sudo t/zbd/run-tests-against-nullb -s 1 &&		 	\
>  	if [ -e /sys/module/null_blk/parameters/zoned ]; then		\
> -		sudo t/zbd/run-tests-against-zoned-nullb;	 	\
> +		sudo t/zbd/run-tests-against-nullb -s 2;	 	\
> +		sudo t/zbd/run-tests-against-nullb -s 4;	 	\
>  	fi
>  
>  install: $(PROGS) $(SCRIPTS) $(ENGS_OBJS) tools/plot/fio2gnuplot.1 FORCE
> diff --git a/t/run-fio-tests.py b/t/run-fio-tests.py
> index e5c2f17c..a59cdfe0 100755
> --- a/t/run-fio-tests.py
> +++ b/t/run-fio-tests.py
> @@ -879,8 +879,8 @@ TEST_LIST = [
>      {
>          'test_id':          1007,
>          'test_class':       FioExeTest,
> -        'exe':              't/zbd/run-tests-against-regular-nullb',
> -        'parameters':       None,
> +        'exe':              't/zbd/run-tests-against-nullb',
> +        'parameters':       ['-s', '1'],
>          'success':          SUCCESS_DEFAULT,
>          'requirements':     [Requirements.linux, Requirements.zbd,
>                               Requirements.root],
> @@ -888,8 +888,8 @@ TEST_LIST = [
>      {
>          'test_id':          1008,
>          'test_class':       FioExeTest,
> -        'exe':              't/zbd/run-tests-against-zoned-nullb',
> -        'parameters':       None,
> +        'exe':              't/zbd/run-tests-against-nullb',
> +        'parameters':       ['-s', '2'],
>          'success':          SUCCESS_DEFAULT,
>          'requirements':     [Requirements.linux, Requirements.zbd,
>                               Requirements.root, Requirements.zoned_nullb],
> diff --git a/t/zbd/run-tests-against-nullb b/t/zbd/run-tests-against-nullb
> new file mode 100755
> index 00000000..8d1eb005
> --- /dev/null
> +++ b/t/zbd/run-tests-against-nullb
> @@ -0,0 +1,338 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2020 Western Digital Corporation or its affiliates.
> +#
> +# This file is released under the GPL.
> +#
> +# Run t/zbd/test-zbd-support script against a variety of conventional,
> +# zoned and mixed zone configurations.
> +#
> +
> +function usage()

I would think bash function form "XXX()" is rather newer and better than
"function XXX()", for POSIX conformance and commonality with other scripts
in fio bash scripts.

> +{
> +	echo "This script runs the tests from t/zbd/test-zbd-support script"
> +        echo "against a nullb device in a variety of conventional and zoned"

A nit, spaces are used in place of a tab.

> +	echo "configurations."
> +	echo "Usage: ${0} [OPTIONS]"
> +	echo "Options:"
> +	echo -e "\t-h Show this message."
> +	echo -e "\t-L List the device layouts for every section without running"
> +	echo -e "\t   tests."
> +	echo -e "\t-s <#section> Only run the section with the given number."
> +	echo -e "\t-l Use libzbc ioengine to run the tests."
> +	echo -e "\t-o <max_open_zones> Specify MaxOpen value, (${set_max_open} by default)."
> +	echo -e "\t-n <#number of runs> Set the number of times to run the entire suite "
> +	echo -e "\t   or an individual section/test."
> +	echo -e "\t-r Remove the /dev/nullb0 device that may still exist after"
> +	echo -e "\t   running this script."
> +	exit 1
> +}
> +
> +function cleanup_nullb()
> +{
> +	for d in /sys/kernel/config/nullb/*; do [ -d "$d" ] && rmdir "$d"; done
> +	modprobe -r null_blk
> +	modprobe null_blk nr_devices=0 || exit $?
> +	for d in /sys/kernel/config/nullb/*; do
> +		[ -d "$d" ] && rmdir "$d"
> +	done
> +	modprobe -r null_blk
> +	[ -e /sys/module/null_blk ] && exit $?
> +}
> +
> +function create_nullb()
> +{
> +	modprobe null_blk nr_devices=0 &&
> +	cd /sys/kernel/config/nullb &&
> +	mkdir nullb0 &&
> +	cd nullb0 || return $?
> +}
> +
> +function configure_nullb()
> +{
> +	echo 0 > completion_nsec &&
> +		echo ${dev_blocksize} > blocksize &&
> +		echo ${dev_size} > size &&
> +		echo 1 > memory_backed || return $?
> +
> +	if ((conv_pcnt < 100)); then
> +		echo 1 > zoned &&
> +			echo "${zone_size}" > zone_size || return $?
> +
> +		if ((zone_capacity < zone_size)); then
> +			if ((!zcap_supported)); then
> +				echo "null_blk does not support zone capacity"
> +				return 2
> +			fi
> +			echo "${zone_capacity}" > zone_capacity
> +		fi
> +		if ((conv_pcnt)); then
> +			if ((!conv_supported)); then
> +				echo "null_blk does not support conventional zones"
> +				return 2
> +			fi
> +			nr_conv=$((dev_size/zone_size*conv_pcnt/100))
> +			echo "${nr_conv}" > zone_nr_conv
> +		fi
> +	fi
> +
> +	echo 1 > power || return $?
> +	return 0
> +}
> +
> +function show_nullb_config()
> +{
> +	if ((conv_pcnt < 100)); then
> +		echo "    $(printf "Zoned Device, %d%% Conventional Zones (%d)" \
> +			  ${conv_pcnt} ${nr_conv})"
> +		echo "    $(printf "Zone Size: %d MB" ${zone_size})"
> +		echo "    $(printf "Zone Capacity: %d MB" ${zone_capacity})"
> +		if ((max_open)); then
> +			echo "    $(printf "Max Open: %d Zones" ${max_open})"
> +		else
> +			echo "    Max Open: Unlimited Zones"
> +		fi
> +	else
> +		echo "    Non-zoned Device"
> +	fi
> +}
> +
> +#
> +# Test sections.
> +#
> +# Fully conventional device.
> +function section1

It is not mandatory, but I would like to see parentheses () for the
sectionX function definitions.

> +{
> +	conv_pcnt=100
> +	max_open=0
> +}
> +
> +# Zoned device with no conventional zones, ZCAP == ZSIZE, unlimited MaxOpen.
> +function section2
> +{
> +	conv_pcnt=0
> +	zone_size=1
> +	zone_capacity=1
> +	max_open=0
> +}
> +
> +# Zoned device with no conventional zones, ZCAP < ZSIZE, unlimited MaxOpen.
> +function section3
> +{
> +	conv_pcnt=0
> +	zone_size=4
> +	zone_capacity=3
> +	max_open=0
> +}
> +
> +# Zoned device with mostly sequential zones, ZCAP == ZSIZE, unlimited MaxOpen.
> +function section4
> +{
> +	conv_pcnt=10
> +	zone_size=1
> +	zone_capacity=1
> +	max_open=0
> +}
> +
> +# Zoned device with mostly sequential zones, ZCAP < ZSIZE, unlimited MaxOpen.
> +function section5
> +{
> +	conv_pcnt=10
> +	zone_size=4
> +	zone_capacity=3
> +	max_open=0
> +}
> +
> +# Zoned device with mostly conventional zones, ZCAP == ZSIZE, unlimited MaxOpen.
> +function section6
> +{
> +	conv_pcnt=66
> +	zone_size=1
> +	zone_capacity=1
> +	max_open=0
> +}
> +
> +# Zoned device with mostly conventional zones, ZCAP < ZSIZE, unlimited MaxOpen.
> +function section7
> +{
> +	dev_size=2048
> +	conv_pcnt=66
> +	zone_size=4
> +	zone_capacity=3
> +	max_open=0
> +}
> +
> +# Zoned device with no conventional zones, ZCAP == ZSIZE, limited MaxOpen.
> +function section8
> +{
> +	dev_size=1024
> +	conv_pcnt=0
> +	zone_size=1
> +	zone_capacity=1
> +	max_open=${set_max_open}
> +	zbd_test_opts+=("-o ${max_open}")
> +}
> +
> +# Zoned device with no conventional zones, ZCAP < ZSIZE, limited MaxOpen.
> +function section8

I think you meant section9, not 8.

Other than this, this patch looks good to me.

-- 
Best Regards,
Shin'ichiro Kawasaki



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux