diff mbox series

[blktests,v3,08/12] nvme/rc: Add minimal test image size requirement

Message ID 20230503080258.14525-9-dwagner@suse.de (mailing list archive)
State New, archived
Headers show
Series nvme testsuite runtime optimization | expand

Commit Message

Daniel Wagner May 3, 2023, 8:02 a.m. UTC
Some tests need a minimal test image size to work correctly. Thus add a
helper to check the size and update these tests accordingly.

The image minimum is 4M because some of the test have hard coded values.
All tests which use the xfs fio verification job have a minimum
requirement of 350M impossed by the xfs filesystem.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/012 |  1 +
 tests/nvme/013 |  1 +
 tests/nvme/029 |  1 -
 tests/nvme/045 |  2 +-
 tests/nvme/rc  | 15 +++++++++++++++
 5 files changed, 18 insertions(+), 2 deletions(-)

Comments

Chaitanya Kulkarni May 3, 2023, 9:35 a.m. UTC | #1
On 5/3/23 01:02, Daniel Wagner wrote:
> Some tests need a minimal test image size to work correctly. Thus add a
> helper to check the size and update these tests accordingly.
>
> The image minimum is 4M because some of the test have hard coded values.
> All tests which use the xfs fio verification job have a minimum
> requirement of 350M impossed by the xfs filesystem.
>
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>   tests/nvme/012 |  1 +
>

thanks for documenting minimum limit imposed by fio, look good.


Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Shinichiro Kawasaki May 7, 2023, 11:19 p.m. UTC | #2
Nit: the commit title subject can be "nvme: " since it touches both nvme/rc and
nvme test cases.

On May 03, 2023 / 10:02, Daniel Wagner wrote:
> Some tests need a minimal test image size to work correctly. Thus add a
> helper to check the size and update these tests accordingly.
> 
> The image minimum is 4M because some of the test have hard coded values.
> All tests which use the xfs fio verification job have a minimum
> requirement of 350M impossed by the xfs filesystem.
> 
> Reviewed-by: Hannes Reinecke <hare@suse.de>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  tests/nvme/012 |  1 +
>  tests/nvme/013 |  1 +
>  tests/nvme/029 |  1 -
>  tests/nvme/045 |  2 +-
>  tests/nvme/rc  | 15 +++++++++++++++
>  5 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/nvme/012 b/tests/nvme/012
> index ecf44fcb5a51..efe227538c57 100755
> --- a/tests/nvme/012
> +++ b/tests/nvme/012
> @@ -16,6 +16,7 @@ requires() {
>  	_have_fio
>  	_have_loop
>  	_require_nvme_trtype_is_fabrics
> +	_require_nvme_test_img_size 350m
>  }
>  
>  test() {
> diff --git a/tests/nvme/013 b/tests/nvme/013
> index e249add46295..14e646a19c47 100755
> --- a/tests/nvme/013
> +++ b/tests/nvme/013
> @@ -15,6 +15,7 @@ requires() {
>  	_have_xfs
>  	_have_fio
>  	_require_nvme_trtype_is_fabrics
> +	_require_nvme_test_img_size 350m
>  }
>  
>  test() {
> diff --git a/tests/nvme/029 b/tests/nvme/029
> index 1808b7b0edf1..c6d38b42af70 100755
> --- a/tests/nvme/029
> +++ b/tests/nvme/029
> @@ -14,7 +14,6 @@ requires() {
>  	_nvme_requires
>  	_have_loop
>  	_require_nvme_trtype_is_fabrics
> -	_require_test_dev_size 1M

As I mentioned for the previous patch, this line was added and removed.

>  }
>  
>  test_user_io()
> diff --git a/tests/nvme/045 b/tests/nvme/045
> index 7c51da27b5f1..99012f6bed8f 100755
> --- a/tests/nvme/045
> +++ b/tests/nvme/045
> @@ -120,7 +120,7 @@ test() {
>  
>  	nvmedev=$(_find_nvme_dev "${subsys_name}")
>  
> -	_run_fio_rand_io --size=8m --filename="/dev/${nvmedev}n1"
> +	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
>  
>  	_nvme_disconnect_subsys "${subsys_name}"
>  
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 51dde39c2966..0b4d5f6570d6 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -21,6 +21,7 @@ nvme_img_size=${nvme_img_size:-"1G"}
>  
>  _nvme_requires() {
>  	_have_program nvme
> +	_require_nvme_test_img_size 4m
>  	case ${nvme_trtype} in
>  	loop)
>  		_have_driver nvme-loop
> @@ -94,6 +95,20 @@ _require_test_dev_is_nvme() {
>  	return 0
>  }
>  
> +_require_nvme_test_img_size() {
> +	local require_sz_mb
> +	local nvme_img_size_mb
> +
> +	require_sz_mb="$(convert_to_mb "$1")"
> +	nvme_img_size_mb="$(convert_to_mb "${nvme_img_size}")"
> +
> +	if (( "${nvme_img_size_mb}" < "$require_sz_mb" )); then

FYI, in bash arithmetic operation (( )), we don't need to add "${}" for
variables. Code below should work.

	if ((nvme_img_size_mb < require_sz_mb)); then

> +		SKIP_REASONS+=("nvme_img_size must be at least ${require_sz_mb}m")
> +		return 1
> +	fi
> +	return 0
> +}
> +
>  _require_nvme_trtype() {
>  	local trtype
>  	for trtype in "$@"; do
> -- 
> 2.40.0
>
diff mbox series

Patch

diff --git a/tests/nvme/012 b/tests/nvme/012
index ecf44fcb5a51..efe227538c57 100755
--- a/tests/nvme/012
+++ b/tests/nvme/012
@@ -16,6 +16,7 @@  requires() {
 	_have_fio
 	_have_loop
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
diff --git a/tests/nvme/013 b/tests/nvme/013
index e249add46295..14e646a19c47 100755
--- a/tests/nvme/013
+++ b/tests/nvme/013
@@ -15,6 +15,7 @@  requires() {
 	_have_xfs
 	_have_fio
 	_require_nvme_trtype_is_fabrics
+	_require_nvme_test_img_size 350m
 }
 
 test() {
diff --git a/tests/nvme/029 b/tests/nvme/029
index 1808b7b0edf1..c6d38b42af70 100755
--- a/tests/nvme/029
+++ b/tests/nvme/029
@@ -14,7 +14,6 @@  requires() {
 	_nvme_requires
 	_have_loop
 	_require_nvme_trtype_is_fabrics
-	_require_test_dev_size 1M
 }
 
 test_user_io()
diff --git a/tests/nvme/045 b/tests/nvme/045
index 7c51da27b5f1..99012f6bed8f 100755
--- a/tests/nvme/045
+++ b/tests/nvme/045
@@ -120,7 +120,7 @@  test() {
 
 	nvmedev=$(_find_nvme_dev "${subsys_name}")
 
-	_run_fio_rand_io --size=8m --filename="/dev/${nvmedev}n1"
+	_run_fio_rand_io --size=4m --filename="/dev/${nvmedev}n1"
 
 	_nvme_disconnect_subsys "${subsys_name}"
 
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 51dde39c2966..0b4d5f6570d6 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -21,6 +21,7 @@  nvme_img_size=${nvme_img_size:-"1G"}
 
 _nvme_requires() {
 	_have_program nvme
+	_require_nvme_test_img_size 4m
 	case ${nvme_trtype} in
 	loop)
 		_have_driver nvme-loop
@@ -94,6 +95,20 @@  _require_test_dev_is_nvme() {
 	return 0
 }
 
+_require_nvme_test_img_size() {
+	local require_sz_mb
+	local nvme_img_size_mb
+
+	require_sz_mb="$(convert_to_mb "$1")"
+	nvme_img_size_mb="$(convert_to_mb "${nvme_img_size}")"
+
+	if (( "${nvme_img_size_mb}" < "$require_sz_mb" )); then
+		SKIP_REASONS+=("nvme_img_size must be at least ${require_sz_mb}m")
+		return 1
+	fi
+	return 0
+}
+
 _require_nvme_trtype() {
 	local trtype
 	for trtype in "$@"; do