From: Chaitanya Kulkarni Date: Tue, 18 Sep 2018 02:24:24 +0000 (-0700) Subject: nvme: add NVMeOF effects-log test for file-ns X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4624497bfa867fe4d37fa85db4e63a20451d4f30;p=users%2Fhch%2Fblktests.git nvme: add NVMeOF effects-log test for file-ns Signed-off-by: Chaitanya Kulkarni --- diff --git a/tests/nvme/025 b/tests/nvme/025 new file mode 100755 index 0000000..b12a5f5 --- /dev/null +++ b/tests/nvme/025 @@ -0,0 +1,77 @@ +#!/bin/bash +# Test NVMe effects-log command on NVMeOF with a file-backed ns. +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# Author: Chaitanya Kulkarni +# + +. tests/nvme/rc + +DESCRIPTION="test NVMe effects-log command on NVMeOF file-backed ns" +QUICK=1 + +requires() { + _have_program nvme && _have_module nvme-loop && _have_module loop && \ + _have_module nvmet && _have_configfs +} + +test() { + echo "Running ${TEST_NAME}" + + modprobe nvmet + modprobe nvme-loop + + local port + local nvmedev + local file_path="$TMPDIR/img" + local subsys_name="blktests-subsystem-1" + + truncate -s 1G "${file_path}" + + _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + port="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + + nvme connect -t loop -n "${subsys_name}" + + nvmedev="$(_find_nvme_loop_dev)" + cat "/sys/block/${nvmedev}n1/uuid" + cat "/sys/block/${nvmedev}n1/wwid" + + nvme effects-log "/dev/${nvmedev}" > /dev/null 2>&1 + + rc=$? + + nvme disconnect -n "${subsys_name}" + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_port "${port}" + + rm -f "${file_path}" + + modprobe -r nvme-loop + modprobe -r nvmet + + if [ $rc -ne 0 ]; then + echo "Test Failed" + else + echo "Test complete" + fi +} diff --git a/tests/nvme/025.out b/tests/nvme/025.out new file mode 100644 index 0000000..b700bc7 --- /dev/null +++ b/tests/nvme/025.out @@ -0,0 +1,5 @@ +Running nvme/025 +91fdba0d-f87b-4c25-b80f-db7be1418b9e +uuid.91fdba0d-f87b-4c25-b80f-db7be1418b9e +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete