[Unit-tests] Collect crash data when a unit-test core-dumps

This commit is contained in:
Andrey Volk 2019-12-27 19:25:38 +04:00
parent 837e8955fa
commit 9762569bfa
3 changed files with 16 additions and 3 deletions

View File

@ -7,6 +7,7 @@ steps:
image: signalwire/freeswitch-public-base
pull: true
commands:
- cat /proc/sys/kernel/core_pattern
- ./bootstrap.sh -j
- echo "applications/mod_test" >> modules.conf
- ./configure
@ -15,7 +16,8 @@ steps:
- ./build.sh
- cd tests/unit
- ./run-tests.sh
- mkdir logs && (mv log_run-tests_*.html logs || true)
- ls -la /cores
- mkdir logs && (mv log_run-tests_*.html logs || true) && (mv backtrace_*.txt logs || true)
- echo 0 > run-tests-status.txt
- ./collect-test-logs.sh && exit 0 || echo 'Some tests failed'
- echo 1 > run-tests-status.txt
@ -42,6 +44,6 @@ trigger:
- push
---
kind: signature
hmac: a34718dd1e2b9468a845962219ff05cac0c922ddf90d885af557a937a9e412e0
hmac: ee1de4cb1fa925cf61ac67c76c54d553e4376b3a828480d39ce99a67fabae298
...

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 "----------------" ;