Commit 1a903f9c authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

opal: Don't use set +e to ignore errors.



For errors that we do want to ignore, use || true after the commands.
This allows crashes in the background target application to fail
the tests.

Change-Id: I1fcd711c17ad0a956b6778260b2db8c0b801584f
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/475156


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 91cc56ac
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -914,14 +914,12 @@ function opal_revert_cleanup {
	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
	# Ignore if this fails.
	$rootdir/scripts/rpc.py bdev_nvme_opal_revert -b nvme0 -p test || true

	killprocess $spdk_tgt_pid
}
+2 −6
Original line number Diff line number Diff line
@@ -14,9 +14,7 @@ function opal_init() {

	# Ignore bdev_nvme_opal_init failure because sometimes revert TPer might fail and
	# in another run we don't want init to return errors to stop other tests.
	set +e
	$rpc_py bdev_nvme_opal_init -b nvme0 -p test
	set -e
	$rpc_py bdev_nvme_opal_init -b nvme0 -p test || true
}

function test_opal_cmds() {
@@ -72,9 +70,7 @@ function clean_up() {

function revert() {
	# Ignore revert failure and kill the process
	set +e
	$rpc_py bdev_nvme_opal_revert -b nvme0 -p test
	set -e
	$rpc_py bdev_nvme_opal_revert -b nvme0 -p test || true
}

$rootdir/app/spdk_tgt/spdk_tgt &