Merge pull request #194 from signalwire/coredump

[Unit-tests] Collect crash data when a unit-test core-dumps
This commit is contained in:
Andrey Volk
2020-01-06 22:49:21 +04:00
committed by GitHub
3 changed files with 16 additions and 3 deletions

View File

@@ -10,7 +10,12 @@ for name in $logs
do
logname=$(basename $name)
testname=$(echo $logname | awk -F 'log_run-tests_' '{print $2}' | awk -F '.html' '{print $1}')
html+="<tr align=\"left\"><td><a href="$logname">$testname</a></td></tr>"
html+="<tr align=\"left\"><td><a href="$logname">$testname</a>"
backtrace="backtrace_$testname.txt"
if test -f "${LOG_DIR}/$backtrace"; then
html+=". Core dumped, backtrace is available <a href=\"$backtrace\">here</a>"
fi
html+="</td></tr>"
logs_found=1
done

View File

@@ -21,6 +21,12 @@ do
rm $logfilename ;
else
echo "*** ./$i exit status is $exitstatus" ;
if ls /cores/core.*.!drone!src!tests!unit!.libs!$i.* 1> /dev/null 2>&1; then
echo "Coredump found";
COREDUMP=$(ls /cores/core.*.!drone!src!tests!unit!.libs!$i.*) ;
echo $COREDUMP;
gdb -ex "set logging file backtrace_$i.txt" -ex "set logging on" -ex "set pagination off" -ex "bt" -ex "bt full" -ex "info threads" -ex "thread apply all bt" -ex "thread apply all bt full" -ex "quit" /drone/src/tests/unit/.libs/$i $COREDUMP ;
fi ;
echo "*** $logfilename was saved" ;
fi ;
echo "----------------" ;