Merge pull request #6803 from edolstra/test-stack-trace
On test failures, print a bash stack trace
This commit is contained in:
commit
73ff9b863c
1 changed files with 15 additions and 4 deletions
|
@ -119,11 +119,11 @@ killDaemon() {
|
|||
}
|
||||
|
||||
restartDaemon() {
|
||||
[[ -z "${pidDaemon:-}" ]] && return 0
|
||||
[[ -z "${pidDaemon:-}" ]] && return 0
|
||||
|
||||
killDaemon
|
||||
unset NIX_REMOTE
|
||||
startDaemon
|
||||
killDaemon
|
||||
unset NIX_REMOTE
|
||||
startDaemon
|
||||
}
|
||||
|
||||
if [[ $(uname) == Linux ]] && [[ -L /proc/self/ns/user ]] && unshare --user true; then
|
||||
|
@ -190,4 +190,15 @@ if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
|
|||
startDaemon
|
||||
fi
|
||||
|
||||
onError() {
|
||||
set +x
|
||||
echo "$0: test failed at:" >&2
|
||||
for ((i = 1; i < 16; i++)); do
|
||||
if [[ -z ${BASH_SOURCE[i]} ]]; then break; fi
|
||||
echo " ${FUNCNAME[i]} in ${BASH_SOURCE[i]}:${BASH_LINENO[i-1]}" >&2
|
||||
done
|
||||
}
|
||||
|
||||
trap onError ERR
|
||||
|
||||
fi # COMMON_SH_SOURCED
|
||||
|
|
Loading…
Reference in a new issue