new file mode 100755
@@ -0,0 +1,69 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2019 Logan Gunthorpe
+# Copyright (C) 2019 Eideticom Communications Inc.
+
+. tests/nvme/rc
+
+DESCRIPTION="create and connect to an NVMeOF target with a passthru controller"
+QUICK=1
+
+requires() {
+ _have_program nvme &&
+ _have_modules nvme-loop nvmet &&
+ _have_configfs &&
+ _have_kernel_option NVME_TARGET_PASSTHRU
+}
+
+nvme_info() {
+ local ns=$1
+
+ nvme id-ctrl "$ns" | grep -E '^(vid|sn|mn|fr) '
+ nvme id-ns "$ns" | grep -E '^(nsze|ncap) '
+}
+
+compare_dev_info() {
+ local passthru_dev=$1
+ local testdev_info
+ local passthru_info
+
+ testdev_info=$(nvme_info "$TEST_DEV")
+ passthru_info=$(nvme_info "$passthru_dev")
+
+ cat >> "${FULL}" <<- EOF
+
+ Test Device ${TEST_DEV} Info:
+ $testdev_info
+
+ Passthru Device ${passthru_dev} Info:
+ $passthru_info
+
+ EOF
+
+ diff -u <(echo "$testdev_info") <(echo "$passthru_info")
+ if [[ "$testdev_info" != "$passthru_info" ]]; then
+ echo "ERROR: Device information does not match! (See ${FULL})"
+ fi
+}
+
+test_device() {
+ local subsys="blktests-subsystem-1"
+ local nsdev
+ local port
+
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+ port=$(_nvmet_passthru_target_setup "$subsys")
+
+ nvme discover -t loop | _filter_discovery
+
+ nsdev=$(_nvmet_passthru_target_connect "$subsys")
+
+ compare_dev_info "${nsdev}"
+
+ _nvmet_passthru_target_disconnect "$subsys"
+ _nvmet_passthru_target_cleanup "$port" "$subsys"
+
+ echo "Test complete"
+}
new file mode 100644
@@ -0,0 +1,6 @@
+Running nvme/033
+Discovery Log Number of Records 1, Generation counter X
+=====Discovery Log Entry 0======
+trtype: loop
+subnqn: blktests-subsystem-1
+Test complete
This tests creates and connects to a passthru controller backed by a test NVMe namespace. It then verifies that some common fields in id-ctrl and id-ns are the same in the target and the orginial device. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- tests/nvme/033 | 69 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 6 ++++ 2 files changed, 75 insertions(+) create mode 100755 tests/nvme/033 create mode 100644 tests/nvme/033.out