Commit 2176f081 authored by Chunyang Hui's avatar Chunyang Hui Committed by Jim Harris
Browse files

test/opal: Enable OPAL test



Also add opal_revert_cleanup at the start of autotest.sh
because opal test might fail before revert and the drive
might be kept locked and will cause deny of service in
later test.

Change-Id: Icb9d571c59804daa559784cee457c7e804eff121
Signed-off-by: default avatarChunyang Hui <chunyang.hui@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471973


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 62c8e6cb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -134,6 +134,10 @@ if [[ $SPDK_TEST_CRYPTO -eq 1 || $SPDK_TEST_REDUCE -eq 1 ]]; then
	fi
fi

# Revert existing OPAL to factory settings that may have been left from earlier failed tests.
# This ensures we won't hit any unexpected failures due to NVMe SSDs being locked.
opal_revert_cleanup

#####################
# Unit Tests
#####################
@@ -259,6 +263,10 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
        if [ $SPDK_TEST_REDUCE -eq 1 ]; then
                run_test suite ./test/compress/compress.sh
        fi

	if [ $SPDK_TEST_OPAL -eq 1 ]; then
		run_test suite ./test/nvme/nvme_opal.sh
	fi
fi

timing_enter cleanup
+18 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ export RUN_NIGHTLY_FAILING
: ${SPDK_TEST_OCF=0}; export SPDK_TEST_OCF
: ${SPDK_TEST_FTL_EXTENDED=0}; export SPDK_TEST_FTL_EXTENDED
: ${SPDK_TEST_VMD=0}; export SPDK_TEST_VMD
: ${SPDK_TEST_OPAL=0}; export SPDK_TEST_OPAL
: ${SPDK_AUTOTEST_X=true}; export SPDK_AUTOTEST_X

# Export PYTHONPATH with addition of RPC framework. New scripts can be created
@@ -877,6 +878,23 @@ function get_nvme_name_from_bdf {
	printf '%s\n' "${blkname[@]}"
}

function opal_revert_cleanup {
	$rootdir/app/spdk_tgt/spdk_tgt &
	spdk_tgt_pid=$!
	waitforlisten $spdk_tgt_pid

	# ignore the result
	set +e
	# OPAL test only runs on the first NVMe device
	# So we just revert the first one here
	bdf=$($rootdir/scripts/gen_nvme.sh --json | jq -r '.config[].params | select(.name=="Nvme0").traddr')
	$rootdir/scripts/rpc.py bdev_nvme_attach_controller -b "nvme0" -t "pcie" -a $bdf
	$rootdir/scripts/rpc.py bdev_nvme_opal_revert -b nvme0 -p test
	set -e

	killprocess $spdk_tgt_pid
}

set -o errtrace
trap "trap - ERR; print_backtrace >&2" ERR