Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions common/nvme
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ _check_conflict_and_set_default NVME_NUM_ITER nvme_num_iter 1000
nvmet_blkdev_type=${nvmet_blkdev_type:-"device"}
NVMET_BLKDEV_TYPES=${NVMET_BLKDEV_TYPES:-"device file"}
nvme_target_control="${NVME_TARGET_CONTROL:-}"
NVMET_CFS="/sys/kernel/config/nvmet/"
NVMET_CFS="/sys/kernel/config/nvmet"
# shellcheck disable=SC2034
NVMET_DFS="/sys/kernel/debug/nvmet/"
NVMET_DFS="/sys/kernel/debug/nvmet"
nvme_trtype=${nvme_trtype:-}
nvme_adrfam=${nvme_adrfam:-}

Expand Down Expand Up @@ -285,6 +285,7 @@ _nvme_connect_subsys() {
local ctrl_loss_tmo=""
local no_wait=false
local no_wait_ns=false
local expect_failure=false
local hdr_digest=false
local data_digest=false
local tls=false
Expand Down Expand Up @@ -352,6 +353,10 @@ _nvme_connect_subsys() {
no_wait_ns=true
shift 1
;;
--expect-failure)
expect_failure=true
shift 1
;;
--hdr-digest)
hdr_digest=true
shift 1
Expand Down Expand Up @@ -433,6 +438,16 @@ _nvme_connect_subsys() {
fi
ARGS+=(--output-format=json)
connect=$(nvme connect "${ARGS[@]}" 2> /dev/null)
ret=$?
if [[ ${expect_failure} = false ]]; then
if [[ ${ret} != 0 ]]; then
echo "FAIL: nvme connect return error code"
fi
else
if [[ ${ret} == 0 ]]; then
echo "FAIL: nvme connect did not return error code"
fi
fi

# Wait until device file and sysfs attributes get ready
if [[ ${no_wait} = false ]]; then
Expand Down
2 changes: 1 addition & 1 deletion tests/nvme/041
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test() {

# Test unauthenticated connection (should fail)
echo "Test unauthenticated connection (should fail)"
_nvme_connect_subsys --no-wait
_nvme_connect_subsys --no-wait --expect-failure

_nvme_disconnect_subsys

Expand Down
6 changes: 4 additions & 2 deletions tests/nvme/044
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ test() {
# and invalid ctrl authentication
echo "Test invalid ctrl authentication (should fail)"
_nvme_connect_subsys --dhchap-secret "${hostkey}" \
--dhchap-ctrl-secret "${hostkey}" --no-wait
--dhchap-ctrl-secret "${hostkey}" \
--no-wait --expect-failure

_nvme_disconnect_subsys

Expand All @@ -76,7 +77,8 @@ test() {
echo "Test invalid ctrl key (should fail)"
invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:"
_nvme_connect_subsys --dhchap-secret "${hostkey}" \
--dhchap-ctrl-secret "${invkey}" --no-wait
--dhchap-ctrl-secret "${invkey}" \
--no-wait --expect-failure

_nvme_disconnect_subsys

Expand Down
7 changes: 2 additions & 5 deletions tests/nvme/047
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ test() {

_nvmet_target_setup

_nvme_connect_subsys \
--nr-write-queues 1 || echo FAIL
_nvme_connect_subsys --nr-write-queues 1

ns=$(_find_nvme_ns "${def_subsys_uuid}")

Expand All @@ -41,9 +40,7 @@ test() {

_nvme_disconnect_subsys >> "$FULL" 2>&1

_nvme_connect_subsys \
--nr-write-queues 1 \
--nr-poll-queues 1 || echo FAIL
_nvme_connect_subsys --nr-write-queues 1 --nr-poll-queues 1

_run_fio_rand_io --filename="/dev/${ns}" --size="${rand_io_size}"

Expand Down
2 changes: 1 addition & 1 deletion tests/nvme/062
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ test() {

# Test unencrypted connection
echo "Test unencrypted connection w/ tls required (should fail)"
_nvme_connect_subsys --no-wait
_nvme_connect_subsys --no-wait --expect-failure

_nvme_disconnect_subsys

Expand Down