autotest_common: fix xtrace_restore_enable
My previous patch enabling this to be called recursively didn't
take into account that a single call to xtrace_restore would
override multiple levels of xtrace_disable nesting. This change fixes
that.
fixes: 190b2245c5
Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I2167ba460e68223c9426b3d71e9c17019f947924
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478959
Community-CI: SPDK CI Jenkins <sys_sgci@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
fd73cb78d8
commit
39fe5c849b
@ -5,6 +5,10 @@ function xtrace_disable() {
|
|||||||
XTRACE_DISABLED="yes"
|
XTRACE_DISABLED="yes"
|
||||||
fi
|
fi
|
||||||
set +x
|
set +x
|
||||||
|
elif [ -z $XTRACE_NESTING_LEVEL ]; then
|
||||||
|
XTRACE_NESTING_LEVEL=1
|
||||||
|
else
|
||||||
|
XTRACE_NESTING_LEVEL=$((++XTRACE_NESTING_LEVEL))
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,7 +27,17 @@ function xtrace_enable() {
|
|||||||
# Keep it as alias to avoid xtrace_enable backtrace always pointing to xtrace_restore.
|
# Keep it as alias to avoid xtrace_enable backtrace always pointing to xtrace_restore.
|
||||||
# xtrace_enable will appear as called directly from the user script, from the same line
|
# xtrace_enable will appear as called directly from the user script, from the same line
|
||||||
# that "called" xtrace_restore.
|
# that "called" xtrace_restore.
|
||||||
alias xtrace_restore='if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then set -x; XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; xtrace_enable; fi'
|
alias xtrace_restore=\
|
||||||
|
'if [ -z $XTRACE_NESTING_LEVEL ]; then
|
||||||
|
if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then
|
||||||
|
XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; set -x; xtrace_enable;
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
XTRACE_NESTING_LEVEL=$((--XTRACE_NESTING_LEVEL));
|
||||||
|
if [ $XTRACE_NESTING_LEVEL -eq "0" ]; then
|
||||||
|
unset XTRACE_NESTING_LEVEL
|
||||||
|
fi
|
||||||
|
fi'
|
||||||
|
|
||||||
: ${RUN_NIGHTLY:=0}
|
: ${RUN_NIGHTLY:=0}
|
||||||
export RUN_NIGHTLY
|
export RUN_NIGHTLY
|
||||||
@ -950,7 +964,9 @@ trap "trap - ERR; print_backtrace >&2" ERR
|
|||||||
|
|
||||||
PS4=' \t \$ '
|
PS4=' \t \$ '
|
||||||
if $SPDK_AUTOTEST_X; then
|
if $SPDK_AUTOTEST_X; then
|
||||||
# explicitly enable xtraces
|
# explicitly enable xtraces, overriding any tracking information.
|
||||||
|
unset XTRACE_DISABLED
|
||||||
|
unset XTRACE_NESTING_LEVEL
|
||||||
set -x
|
set -x
|
||||||
xtrace_enable
|
xtrace_enable
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user