Commit 05c13e50 authored by Michal Nowak's avatar Michal Nowak Committed by Michał Kępień

Rationalize backtrace logging

GDB backtrace generated via "thread apply all bt full" is too long for
standard output, lets save them to .txt file among other log files.
parent b232e858
...@@ -246,11 +246,15 @@ else ...@@ -246,11 +246,15 @@ else
exit $status exit $status
fi fi
get_core_dumps() {
find "$systest/" \( -name 'core*' -or -name '*.core' \) ! -name '*.gz' ! -name '*.txt' | sort
}
if [ $status != 0 ]; then if [ $status != 0 ]; then
echofail "R:$systest:FAIL" echofail "R:$systest:FAIL"
# Do not clean up - we need the evidence. # Do not clean up - we need the evidence.
else else
core_dumps="$(find "$systest/" -name 'core*' -or -name '*.core' | sort | tr '\n' ' ')" core_dumps=$(get_core_dumps | tr '\n' ' ')
assertion_failures=$(find "$systest/" -name named.run -print0 | xargs -0 grep "assertion failure" | wc -l) assertion_failures=$(find "$systest/" -name named.run -print0 | xargs -0 grep "assertion failure" | wc -l)
sanitizer_summaries=$(find "$systest/" -name 'tsan.*' | wc -l) sanitizer_summaries=$(find "$systest/" -name 'tsan.*' | wc -l)
if [ -n "$core_dumps" ]; then if [ -n "$core_dumps" ]; then
...@@ -258,17 +262,28 @@ else ...@@ -258,17 +262,28 @@ else
echoinfo "I:$systest:Test claims success despite crashes: $core_dumps" echoinfo "I:$systest:Test claims success despite crashes: $core_dumps"
echofail "R:$systest:FAIL" echofail "R:$systest:FAIL"
# Do not clean up - we need the evidence. # Do not clean up - we need the evidence.
find "$systest/" -name 'core*' -or -name '*.core' | while read -r coredump; do get_core_dumps | while read -r coredump; do
export SYSTESTDIR="$systest" export SYSTESTDIR="$systest"
echoinfo "D:$systest:backtrace from $coredump start" echoinfo "D:$systest:backtrace from $coredump:"
binary=$(gdb --batch --core="$coredump" | sed -ne "s/Core was generated by \`//;s/ .*'.$//p;") echoinfo "D:$systest:--------------------------------------------------------------------------------"
binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s/Core was generated by \`//;s/ .*'.$//p;")
"${top_builddir}/libtool" --mode=execute gdb \
-batch \
-ex bt \
-core="$coredump" \
-- \
"$binary" 2>/dev/null | sed -n '/^Core was generated by/,$p' | cat_d
echoinfo "D:$systest:--------------------------------------------------------------------------------"
coredump_backtrace=$(basename "${coredump}")-backtrace.txt
echoinfo "D:$systest:full backtrace from $coredump saved in $coredump_backtrace"
"${top_builddir}/libtool" --mode=execute gdb \ "${top_builddir}/libtool" --mode=execute gdb \
--batch \ -batch \
--command=run.gdb \ -command=run.gdb \
--core="$coredump" \ -core="$coredump" \
-- \ -- \
"$binary" "$binary" > "$coredump_backtrace" 2>&1
echoinfo "D:$systest:backtrace from $coredump end" echoinfo "D:$systest:core dump $coredump archived as $coredump.gz"
gzip -1 "${coredump}"
done done
elif [ "$assertion_failures" -ne 0 ]; then elif [ "$assertion_failures" -ne 0 ]; then
status=1 status=1
...@@ -283,14 +298,12 @@ else ...@@ -283,14 +298,12 @@ else
echofail "R:$systest:FAIL" echofail "R:$systest:FAIL"
else else
echopass "R:$systest:PASS" echopass "R:$systest:PASS"
if $clean if $clean; then
then
( cd "${systest}" && $SHELL clean.sh "$@" ) ( cd "${systest}" && $SHELL clean.sh "$@" )
if [ "${srcdir}" != "${builddir}" ]; then if [ "${srcdir}" != "${builddir}" ]; then
rm -rf "./${systest}" ## FIXME (this also removes compiled binaries) rm -rf "./${systest}" ## FIXME (this also removes compiled binaries)
fi fi
if test -d ${srcdir}/../../../.git if test -d ${srcdir}/../../../.git; then
then
git status -su --ignored "${systest}" 2>/dev/null | \ git status -su --ignored "${systest}" 2>/dev/null | \
sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \ sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \
-e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \ -e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment