mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-02-20 09:26:37 +00:00
Improve test framework: shell backtraces
When in a the finalise part of a test (possibly as a result of a failure or error), make sure that shell backtraces do not list the test case functions that failed, since they have already been reported in a backtrace at the point of failure
This commit is contained in:
parent
c5014baf62
commit
874a3a9ef7
@ -1263,7 +1263,7 @@ _tfw_fail() {
|
||||
_tfw_backtrace() {
|
||||
tfw_log '#----- shell backtrace -----'
|
||||
local -i up=1
|
||||
while [ "${BASH_SOURCE[$up]}" == "${BASH_SOURCE[0]}" ]; do
|
||||
while [ "${BASH_SOURCE[$up]}" == "${BASH_SOURCE[0]}" -a "${FUNCNAME[$up]}" != '_tfw_finalise' ]; do
|
||||
let up=up+1
|
||||
done
|
||||
local -i i=0
|
||||
@ -1307,10 +1307,14 @@ _tfw_errormsg() {
|
||||
local -i up=1
|
||||
local -i top=${#FUNCNAME[*]}
|
||||
let top=top-1
|
||||
while [ $up -lt $top -a "${BASH_SOURCE[$up]}" == "${BASH_SOURCE[0]}" ]; do
|
||||
while [ $up -lt $top -a "${BASH_SOURCE[$up]}" = "${BASH_SOURCE[0]}" -a "${FUNCNAME[$up]}" != '_tfw_finalise' ]; do
|
||||
let up=up+1
|
||||
done
|
||||
tfw_log "ERROR: in ${FUNCNAME[$up]}: $*"
|
||||
if [ "${BASH_SOURCE[$up]}" = "${BASH_SOURCE[0]}" ]; then
|
||||
tfw_log "ERROR: $*"
|
||||
else
|
||||
tfw_log "ERROR: in ${FUNCNAME[$up]}: $*"
|
||||
fi
|
||||
}
|
||||
|
||||
_tfw_error() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user