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 <james.r.harris@intel.com> Change-Id: I481f50b046eb13e23f7048672281ec7d62a573a2 Reviewed-on: https://review.gerrithub.io/423921 Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
f4d78f1886
commit
b5d1b4f445
@ -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: =========="
|
||||
|
Loading…
Reference in New Issue
Block a user