From b5d1b4f44533eccfd21dc690b3ad18bf7b15d6e5 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Wed, 29 Aug 2018 09:01:10 -0700 Subject: [PATCH] test: don't print backtrace when errexit is off Some test scripts may temporarily disable errexit - for example, trying a command several times until it succeeds. In these cases we don't want to print a backtrace every time that command fails. Signed-off-by: Jim Harris Change-Id: I481f50b046eb13e23f7048672281ec7d62a573a2 Reviewed-on: https://review.gerrithub.io/423921 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Pawel Wodkowski Reviewed-by: Shuhei Matsumoto --- test/common/autotest_common.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index a4c82b742..7f674eaf0 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -439,6 +439,9 @@ function run_test() { } function print_backtrace() { + # if errexit is not enabled, don't print a backtrace + [[ "$-" =~ e ]] || return 0 + local shell_options="$-" set +x echo "========== Backtrace start: =========="