Commit 5000bd48 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/nvmf: Don't inherit last exit status from errexit



If return is called without specifying the exit status while being
used in the trap context, it inherits the exit status code from the
last cmd that triggered the errexit (i.e. the cmd which was run right
before the trap). In this particular case it may be quite unexpected
since return is called after successful execution of the modprobe,
implying the overal success of the function. However, as set -e is
called right before return, the function returns with a != 0.

To avoid this behavior, explicitly return from the function with 0.

Change-Id: I8b21e7aa6cd5628f14b66e559d05b4d0a20e2050
Signed-off-by: default avatarMichal Berger <michalx.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1807


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI
Reviewed-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent ab0bc5c2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ function nvmfcleanup()
		modprobe -v -r nvme-$TEST_TRANSPORT
		if modprobe -v -r nvme-fabrics; then
			set -e
			return
			return 0
		fi
		sleep 1
	done