# prints bash call stack
print_stack_trace() {
+ local skip=${1:-1}
echo " Trace dump:"
- for (( i=1; i < ${#BASH_LINENO[*]} ; i++ )) ; do
- local s=${BASH_SOURCE[$i]}
- local l=${BASH_LINENO[$i-1]}
- local f=${FUNCNAME[$i]}
- echo " = $s:$l:$f()"
+ for (( i=$skip; i < ${#BASH_LINENO[*]} ; i++ )) ; do
+ local src=${BASH_SOURCE[$i]}
+ local lineno=${BASH_LINENO[$i-1]}
+ local funcname=${FUNCNAME[$i]}
+ echo " = $src:$lineno:$funcname()"
done
}
-##################################
-# Test interface
-##################################
-
-error_noexit() {
+report_error() {
local TYPE=${TYPE:-"FAIL"}
local dump=true
dump=false
fi
-
log " ${TESTSUITE} ${TESTNAME}: @@@@@@ ${TYPE}: $@ "
- print_stack_trace >&2
-
+ (print_stack_trace 2) >&2
mkdir -p $LOGDIR
# We need to dump the logs on all nodes
if $dump; then
reset_fail_loc
}
+##################################
+# Test interface
+##################################
+
+error_noexit() {
+ report_error "$@"
+}
+
exit_status () {
local status=0
local log=$TESTSUITELOG
}
error() {
- error_noexit "$@"
+ report_error "$@"
exit 1
}
error_exit() {
- error "$@"
+ report_error "$@"
+ exit 1
}
# use only if we are ignoring failures for this test, bugno required.
error_ignore() {
local TYPE="IGNORE ($1)"
shift
- error_noexit "$@"
+ report_error "$@"
}
error_and_remount() {
- error_noexit "$@"
+ report_error "$@"
remount_client $MOUNT
exit 1
}