Thread (18 messages) 18 messages, 2 authors, 2020-02-14
STALE2332d
Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH 2/5 blktests] nvme: test target cntlid min cntlid max

From: Chaitanya Kulkarni <hidden>
Date: 2020-01-29 23:29:32
Also in: linux-nvme
Subsystem: the rest · Maintainer: Linus Torvalds

The new testcases exercises newly added cntlid [min|max] attributes
for NVMeOF target.

Signed-off-by: Chaitanya Kulkarni <redacted>
---
 tests/nvme/033     | 57 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/033.out |  4 ++++
 2 files changed, 61 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..97eba7f
--- /dev/null
+++ b/tests/nvme/033
@@ -0,0 +1,57 @@
+#!/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
+
+requires() {
+	_have_program nvme && _have_modules loop nvme-loop nvmet && \
+		_have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	local port
+	local nvmedev
+	local loop_dev
+	local cid_min=14
+	local cid_max=15
+	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" ${cid_min} ${cid_max}
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help