From 5000bd4885773ff44e1e1dda3db9bc24eb3a2d5f Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Fri, 10 Apr 2020 16:19:34 +0200 Subject: [PATCH] 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: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1807 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Reviewed-by: Maciej Szwed Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- test/nvmf/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index 479447df2..2af08fa4a 100644 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -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