[PATCH blktests 09/10] nvme: skip the tests which need a feature the remote target lacks

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Wed Nov 11 02:33:36 PST 2026


On Nov 04, 2026 / 17:44, Daniel Wagner wrote:
> An NVME_TARGET_CONTROL target need not implement the optional commands.
> A storage array, for example, has fixed ports, manages the ANA states
> itself and may not take host keys or a TLS key from blktests. The tests
> which use a missing command then fail, e.g. nvme/057 on set-ana.
> 
> Add _require_nvme_target_control_feature, which checks the features
> config --show-features lists. Use it in the tests which add and remove
> ports (nvme/031), set ANA states (nvme/057), change host keys (nvme/042
> to nvme/045, nvme/063) or set up TLS (nvme/062, nvme/063). No target
> lists tls yet: blktests doesn't pass the TLS key to the script.
> 
> Signed-off-by: Daniel Wagner <dwagner at suse.de>
[...]
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 3c3ed680e416..6bdd4058586a 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -155,6 +155,24 @@ _require_remote_nvme_target() {
>  	return 0
>  }
>  
> +# Skip the test if the NVME_TARGET_CONTROL target lacks one of the features,
> +# the optional commands and e.g. tls, see Documentation/running-tests.md.
> +_require_nvme_target_control_feature() {
> +	local features feature
> +
> +	if [[ -z "${nvme_target_control}" ]]; then
> +		return 0
> +	fi
> +	features=" $("${nvme_target_control}" config --show-features) "
> +	for feature in "$@"; do
> +		if [[ "${features}" != *" ${feature} "* ]]; then

The line above is a bit confusing for me. I guess the line can be simpler as
follows:

		if [[ "${features}" =~ " ${feature} " ]]; then

May I ask you to confirm it?

> +			SKIP_REASONS+=("NVME_TARGET_CONTROL target does not support ${feature}")
> +			return 1
> +		fi
> +	done
> +	return 0
> +}
> +
>  _test_dev_nvme_ctrl() {
>  	echo "/dev/char/$(cat "${TEST_DEV_SYSFS}/device/dev")"
>  }
> 
> -- 
> 2.56.0
> 



More information about the Linux-nvme mailing list