[PATCH blktests] nvme/{016,017}: use _check_genctr instead of _filter_discovery

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Tue May 30 22:36:30 PDT 2023


CC+: linux-nvme

On May 31, 2023 / 09:07, Yang Xu wrote:
> Since commit 328943e3 ("Update tests for discovery log page changes"),
> blktests also include the discovery subsystem itself. But it
> will lead these cases fails on older nvme-cli system.

Thanks for this report. What is the nvme-cli version with the issue?

> 
> To avoid this, like nvme/002, use _check_genctr to check instead of
> comparing many discovery Log Entry output.
> 
> Signed-off-by: Yang Xu <xuyang2018.jy at fujitsu.com>

The change looks fine to me, but I'd wait for comments by nvme developers.

> ---
>  tests/nvme/016     | 4 +++-
>  tests/nvme/016.out | 7 -------
>  tests/nvme/017     | 5 ++++-
>  tests/nvme/017.out | 7 -------
>  4 files changed, 7 insertions(+), 16 deletions(-)
> 
> diff --git a/tests/nvme/016 b/tests/nvme/016
> index c0c31a5..f617cf1 100755
> --- a/tests/nvme/016
> +++ b/tests/nvme/016
> @@ -24,6 +24,7 @@ test() {
>  	_setup_nvmet
>  
>  	loop_dev="$(losetup -f)"
> +	local genctr=1
>  
>  	_create_nvmet_subsystem "${subsys_nqn}" "${loop_dev}"
>  
> @@ -34,7 +35,8 @@ test() {
>  	port="$(_create_nvmet_port "${nvme_trtype}")"
>  	_add_nvmet_subsys_to_port "$port" "${subsys_nqn}"
>  
> -	_nvme_discover loop | _filter_discovery
> +	genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
> +
>  	_remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}"
>  	_remove_nvmet_port "${port}"
>  
> diff --git a/tests/nvme/016.out b/tests/nvme/016.out
> index ee631a4..fd244d5 100644
> --- a/tests/nvme/016.out
> +++ b/tests/nvme/016.out
> @@ -1,9 +1,2 @@
>  Running nvme/016
> -Discovery Log Number of Records 2, Generation counter X
> -=====Discovery Log Entry 0======
> -trtype:  loop
> -subnqn:  nqn.2014-08.org.nvmexpress.discovery
> -=====Discovery Log Entry 1======
> -trtype:  loop
> -subnqn:  blktests-subsystem-1
>  Test complete
> diff --git a/tests/nvme/017 b/tests/nvme/017
> index e167450..3dbb7c1 100755
> --- a/tests/nvme/017
> +++ b/tests/nvme/017
> @@ -27,6 +27,8 @@ test() {
>  
>  	truncate -s "${nvme_img_size}" "${file_path}"
>  
> +	local genctr=1
> +
>  	_create_nvmet_subsystem "${subsys_name}" "${file_path}" \
>  		"91fdba0d-f87b-4c25-b80f-db7be1418b9e"
>  
> @@ -37,7 +39,8 @@ test() {
>  	port="$(_create_nvmet_port "${nvme_trtype}")"
>  	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
>  
> -	_nvme_discover loop | _filter_discovery
> +	genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
> +
>  	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
>  	_remove_nvmet_port "${port}"
>  
> diff --git a/tests/nvme/017.out b/tests/nvme/017.out
> index 12787f7..6ce9a80 100644
> --- a/tests/nvme/017.out
> +++ b/tests/nvme/017.out
> @@ -1,9 +1,2 @@
>  Running nvme/017
> -Discovery Log Number of Records 2, Generation counter X
> -=====Discovery Log Entry 0======
> -trtype:  loop
> -subnqn:  nqn.2014-08.org.nvmexpress.discovery
> -=====Discovery Log Entry 1======
> -trtype:  loop
> -subnqn:  blktests-subsystem-1
>  Test complete
> -- 
> 2.39.1
> 


More information about the Linux-nvme mailing list