run-tests: Print a separator when the script fails
When the script fails without running any tests, it is hard to find the actual failure. Print a marker before the teardown starts to make it easier to locate the last line that triggered the error. Example marker: ===== T E A R D O W N ===== Signed-off-by: Till Maas <opensource@till.name>
This commit is contained in:
parent
5d383493f6
commit
3590ef82d3
@ -147,7 +147,25 @@ function collect_artifacts {
|
||||
"
|
||||
}
|
||||
|
||||
function write_separator {
|
||||
set +x
|
||||
local text="$(echo "${1}" | sed 's,., \0,g') "
|
||||
local char="="
|
||||
|
||||
local textlength=$(echo -n "${text}" | wc --chars)
|
||||
local cols="$(tput cols)"
|
||||
local wraplength=$(((cols - textlength) / 2))
|
||||
|
||||
eval printf %.1s "${char}"'{1..'"${wraplength}"\}
|
||||
echo -n "${text}"
|
||||
wraplength=$((wraplength + ((cols - textlength) % 2)))
|
||||
eval printf %.1s "${char}"'{1..'"${wraplength}"\}
|
||||
echo
|
||||
set -x
|
||||
}
|
||||
|
||||
function run_exit {
|
||||
write_separator "TEARDOWN"
|
||||
dump_network_info
|
||||
collect_artifacts
|
||||
remove_container
|
||||
|
Loading…
x
Reference in New Issue
Block a user