Commit fafd4ec9 authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

test/nvmf: don't use `set +e`



In fio.sh we used `set +e` for bdev deletion RPCs
and for `wait $fio_pid`. Disabling errors from those
RPCs doesn't make sense. We expect FIO to fail due
to bdev hotremoval, but the bdev hotremoval itself
must succeed.

Besides, it's easy to forget to undo `set +e` so
don't use it. For `wait` we can use the following
paradigm instead:

```
rc=0
wait $pid || rc=$?
```

The same applies to nmic.sh, where we expect some
RPC to fail.

Change-Id: I66ce3504a0c6b5da497759f0688b6c0ea6480b61
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457463


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent e2918289
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -52,15 +52,14 @@ $rootdir/scripts/fio.py -p nvmf -i 4096 -d 1 -t read -r 10 &
fio_pid=$!

sleep 3
set +e

$rpc_py destroy_raid_bdev "raid0"
for malloc_bdev in $malloc_bdevs; do
	$rpc_py delete_malloc_bdev "$malloc_bdev"
done

wait $fio_pid
fio_status=$?
fio_status=0
wait $fio_pid || fio_status=$?

nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true

@@ -72,7 +71,6 @@ if [ $fio_status -eq 0 ]; then
else
        echo "nvmf hotplug test: fio failed as expected"
fi
set -e

$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1

+2 −4
Original line number Diff line number Diff line
@@ -27,11 +27,10 @@ $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"

echo "test case1: single bdev can't be used in multiple subsystems"
set +e
$rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode2 -a -s SPDK2
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 Malloc0
nmic_status=$?
nmic_status=0
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 Malloc0 || nmic_status=$?

if [ $nmic_status -eq 0 ]; then
	echo " Adding namespace passed - failure expected."
@@ -41,7 +40,6 @@ if [ $nmic_status -eq 0 ]; then
else
	echo " Adding namespace failed - expected result."
fi
set -e

echo "test case2: host connect to nvmf target in multiple paths"
if [ ! -z $NVMF_SECOND_TARGET_IP ]; then