test_suite: add callstack to all debug output lines

This commit is contained in:
Frank Liepold 2013-12-30 15:58:22 +01:00
parent 1223e54f17
commit ce362660db
3 changed files with 16 additions and 2 deletions

View File

@ -107,7 +107,10 @@ The output fo start_test.sh consists of the following sections:
- Section titled "<date and time> Starting <leaf directory>"
In this section lines starting with "calling ..." mark the call to one of
the functions listed in the aforementioned variables prepare_list,
setup_list, run_list, cleanup_list and finish_list
setup_list, run_list, cleanup_list and finish_list.
The main part of this section consists of output lines of the function
lib_vmsg. These lines have the following format:
<date time> <file:line_no of the call to lib_vmsg> <message> [[<callstack>]]
- In case of an error: Subsection titled "Callstack" (to stderr)

View File

@ -51,6 +51,12 @@ main_set_globals_depending_on_main_host_list
## (main_lock_file_list)
main_prevent_remove_lock_files_code=42
## stack level from which the callstack should be printed in function
## lib_vmsg
## As default we skip the top three, because in general these are constantly
## stdin, start_test.sh and 00_main.sh
main_min_stack_level=3
## host indexed list of bootloaders. In case of lilo we check after installing
## a kernel, that the label given in main_host_bootloader_label_list exists
## in /etc/lilo.conf and call lilo -R <label>. For all other bootloaders we do

View File

@ -97,7 +97,12 @@ function lib_exit
function lib_vmsg
{
if (( verbose_script )); then
echo "$(date +'%Y-%m-%d %H:%M:%S') ${BASH_SOURCE[1]}:${BASH_LINENO[0]}: $*"
echo "$(date +'%Y-%m-%d %H:%M:%S') ${BASH_SOURCE[1]}:${BASH_LINENO[0]}: $* [[$(
for i in $(seq $((${#BASH_SOURCE[@]} - $main_min_stack_level)) -1 1); do
printf '%s' $prefix$(basename ${BASH_SOURCE[$i]}):${BASH_LINENO[$(($i - 1))]}
prefix='->'
done
)]]"
fi
}