On Fri, Feb 14, 2020 at 05:38:30PM -0800, Chaitanya Kulkarni wrote: > The new testcases exercises newly added cntlid [min|max] attributes > for NVMeOF target. > > Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx> > --- > tests/nvme/033 | 61 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/nvme/033.out | 4 +++ > 2 files changed, 65 insertions(+) > create mode 100755 tests/nvme/033 > create mode 100644 tests/nvme/033.out > > diff --git a/tests/nvme/033 b/tests/nvme/033 > new file mode 100755 > index 0000000..49f2fa1 > --- /dev/null > +++ b/tests/nvme/033 > @@ -0,0 +1,61 @@ > +#!/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. > + > +. tests/nvme/rc > + > +DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes" > +QUICK=1 > + > +PORT="" > +NVMEDEV="" > +LOOP_DEV="" > +FILE_PATH="$TMPDIR/img" > +SUBSYS_NAME="blktests-subsystem-1" > + > +_have_cid_min_max() > +{ > + local cid_min=14 > + local cid_max=15 > + > + _setup_nvmet > + truncate -s 1G "${FILE_PATH}" > + LOOP_DEV="$(losetup -f --show "${FILE_PATH}")" > + > + # we can only know skip reason when we create a subsys > + _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \ > + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max} > +} Sorry, I wasn't ignoring these patches, they just made me realize that we really do need a way to skip a test from the test function itself, so I wanted to implement that first. Could you try rebasing on my skip-test branch (https://github.com/osandov/blktests/tree/skip-test) and reworking this so you don't have to split the setup between requires() and test()? > + > +requires() { > + _have_program nvme && _have_modules loop nvme-loop nvmet && \ > + _have_configfs && _have_cid_min_max > +} > + > +test() { > + echo "Running ${TEST_NAME}" > + > + 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 id-ctrl /dev/"${NVMEDEV}"n1 | grep cntlid | tr -s ' ' ' ' > + > + 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}" > + > + echo "Test complete" > +} > diff --git a/tests/nvme/033.out b/tests/nvme/033.out > new file mode 100644 > index 0000000..b1b0d15 > --- /dev/null > +++ b/tests/nvme/033.out > @@ -0,0 +1,4 @@ > +Running nvme/033 > +cntlid : e > +NQN:blktests-subsystem-1 disconnected 1 controller(s) > +Test complete > -- > 2.22.1 >