]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Unit-tests] Collect crash data when a unit-test core-dumps 194/head
authorAndrey Volk <andywolk@gmail.com>
Fri, 27 Dec 2019 15:25:38 +0000 (19:25 +0400)
committerAndrey Volk <andywolk@gmail.com>
Tue, 31 Dec 2019 16:11:43 +0000 (20:11 +0400)
.drone.yml
tests/unit/collect-test-logs.sh
tests/unit/run-tests.sh

index 5331fea2ad0316eaa5ea9815fdd389c56c363241..a8be756006c1891284f93dbc1b3897b7db809c8b 100644 (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
 
 ...
index a46102af72eb98228754b9744e98058a4e39323d..7c76c74dd57b39de17618557729f1bfde915d08b 100755 (executable)
@@ -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
 
index 55c41e203d69e8ef0343be606ecf5f686b2681a3..5f63ff13982e178eca6a64d94f44751a51efec3c 100755 (executable)
@@ -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 "----------------" ;