Merge pull request #6803 from edolstra/test-stack-trace

On test failures, print a bash stack trace
This commit is contained in:
Eelco Dolstra 2022-07-14 15:56:06 +02:00 committed by GitHub
commit 73ff9b863c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,4 +190,15 @@ if [[ -n "${NIX_DAEMON_PACKAGE:-}" ]]; then
startDaemon startDaemon
fi 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 fi # COMMON_SH_SOURCED