Re: [PATCH 4/5 blktests] nvme: test target model attribute

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

 



On Wed, Jan 29, 2020 at 03:29:20PM -0800, Chaitanya Kulkarni wrote:
> The new testcases exercises newly added cntlid [min|max] attribute for
> NVMeOF target.

Model, not cntlid, right?

> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
> ---
>  tests/nvme/034     | 60 ++++++++++++++++++++++++++++++++++++++++++++++
>  tests/nvme/034.out |  3 +++
>  2 files changed, 63 insertions(+)
>  create mode 100755 tests/nvme/034
>  create mode 100644 tests/nvme/034.out
> 
> diff --git a/tests/nvme/034 b/tests/nvme/034
> new file mode 100755
> index 0000000..1a55ff9
> --- /dev/null
> +++ b/tests/nvme/034
> @@ -0,0 +1,60 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
> +#
> +# Test NVMeOF target cntlid[min|max] attributes.

Same here.

> +. tests/nvme/rc
> +
> +DESCRIPTION="Test NVMeOF target model attribute"
> +QUICK=1
> +
> +requires() {
> +	_have_program nvme && _have_modules loop nvme-loop nvmet && \
> +		_have_configfs
> +}
> +
> +test() {
> +	echo "Running ${TEST_NAME}"
> +
> +	_setup_nvmet
> +
> +	local port
> +	local result
> +	local nvmedev
> +	local loop_dev
> +	local model="test~model"
> +	local file_path="$TMPDIR/img"
> +	local subsys_name="blktests-subsystem-1"
> +
> +	truncate -s 1G "${file_path}"
> +
> +	loop_dev="$(losetup -f --show "${file_path}")"
> +
> +	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
> +		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" 0 100 ${model}

Since the cntlid doesn't matter for this test, maybe you should be able
to pass them as "" "" to _create_nvmet_subsystem so it can ignore them?

> +	port="$(_create_nvmet_port "loop")"
> +	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
> +
> +	nvme connect -t loop -n "${subsys_name}"
> +
> +	udevadm settle
> +
> +	nvmedev="$(_find_nvme_loop_dev)"
> +	nvme list | grep ${nvmedev}n1 | grep -q test~model

Can we do

	nvme list | grep "${nvmedev}n1" | grep -o "$model"

And have that in the test output rather than checking the return value?

> +	result=$?
> +
> +	nvme disconnect -n "${subsys_name}"
> +
> +	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
> +	_remove_nvmet_subsystem "${subsys_name}"
> +	_remove_nvmet_port "${port}"
> +
> +	losetup -d "${loop_dev}"
> +
> +	rm "${file_path}"
> +
> +	if [ ${result} -eq 0 ]; then
> +		echo "Test complete"
> +	fi
> +}
> diff --git a/tests/nvme/034.out b/tests/nvme/034.out
> new file mode 100644
> index 0000000..0a7bd2f
> --- /dev/null
> +++ b/tests/nvme/034.out
> @@ -0,0 +1,3 @@
> +Running nvme/034
> +NQN:blktests-subsystem-1 disconnected 1 controller(s)
> +Test complete
> -- 
> 2.22.1
> 



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux