test/common: Make sure that extdebug is enabled as soon as possible
if given script, which executes under the debug tracer, fails before xtrace_restore() is called, the BASH_ARGC[] will miss all the arguments which were passed down till that very point. Similar case can be experienced after tracer is disabled as then all the arguments hold by BASH_ARG{C,V}[] become unavailable (i.e. until tracer is enabled again). Since there's no actual benefit from toggling the extdebug (in fact, it could break DEBUG|RETURN traps if ever used), enable it once when autotest_common.sh is sourced and keep it enabled throughout entire execution of given script. Change-Id: I01001ead1570967a2e550d993f85f12b9f62553e Signed-off-by: Michal Berger <michalx.berger@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/477 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
db65d58359
commit
a8d016910a
@ -5,7 +5,6 @@ function xtrace_disable() {
|
|||||||
XTRACE_DISABLED="yes"
|
XTRACE_DISABLED="yes"
|
||||||
fi
|
fi
|
||||||
set +x
|
set +x
|
||||||
shopt -u extdebug
|
|
||||||
elif [ -z $XTRACE_NESTING_LEVEL ]; then
|
elif [ -z $XTRACE_NESTING_LEVEL ]; then
|
||||||
XTRACE_NESTING_LEVEL=1
|
XTRACE_NESTING_LEVEL=1
|
||||||
else
|
else
|
||||||
@ -31,7 +30,7 @@ function xtrace_enable() {
|
|||||||
alias xtrace_restore=\
|
alias xtrace_restore=\
|
||||||
'if [ -z $XTRACE_NESTING_LEVEL ]; then
|
'if [ -z $XTRACE_NESTING_LEVEL ]; then
|
||||||
if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then
|
if [[ "$PREV_BASH_OPTS" == *"x"* ]]; then
|
||||||
XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; shopt -s extdebug; set -x; xtrace_enable;
|
XTRACE_DISABLED="no"; PREV_BASH_OPTS=""; set -x; xtrace_enable;
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
XTRACE_NESTING_LEVEL=$((--XTRACE_NESTING_LEVEL));
|
XTRACE_NESTING_LEVEL=$((--XTRACE_NESTING_LEVEL));
|
||||||
@ -1065,6 +1064,7 @@ function opal_revert_cleanup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set -o errtrace
|
set -o errtrace
|
||||||
|
shopt -s extdebug
|
||||||
trap "trap - ERR; print_backtrace >&2" ERR
|
trap "trap - ERR; print_backtrace >&2" ERR
|
||||||
|
|
||||||
PS4=' \t \$ '
|
PS4=' \t \$ '
|
||||||
|
Loading…
Reference in New Issue
Block a user