File tree Expand file tree Collapse file tree 3 files changed +118
-1
lines changed
Expand file tree Collapse file tree 3 files changed +118
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ kind : pipeline
3+ name : unit-tests
4+
5+ steps :
6+ - name : bootstrap
7+ image : signalwire/freeswitch-public-base
8+ pull : always
9+ commands :
10+ - ./autogen.sh
11+
12+ - name : configure
13+ image : signalwire/freeswitch-public-base
14+ pull : always
15+ commands :
16+ - apt-get -y install check
17+ - ./configure --with-pic --without-doxygen --disable-stun
18+
19+ - name : build
20+ image : signalwire/freeswitch-public-base
21+ pull : always
22+ commands :
23+ - apt-get -y install check
24+ - echo '#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./build-status.txt\n' > build.sh
25+ - chmod +x build.sh
26+ - ./build.sh
27+
28+ - name : run-tests
29+ image : signalwire/freeswitch-public-base
30+ pull : always
31+ commands :
32+ - apt-get -y install check
33+ - make install
34+ - echo '#!/bin/bash\n./tests.sh |& tee ./tests/unit/unit-tests-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./unit-tests-status.txt\n' > run-tests.sh
35+ - chmod +x run-tests.sh
36+ - make check && exit 0 || echo 'make check failed'
37+ - ./run-tests.sh
38+ - cd tests/unit
39+ - mkdir -p logs && (mv log_run-tests_*.html logs || true) && (mv backtrace_*.txt logs || true)
40+ - ls -la ./logs
41+ - echo 0 > run-tests-status.txt
42+ - ./collect-test-logs.sh && exit 0 || echo 'Some tests failed'
43+ - ls -la
44+ - echo 1 > run-tests-status.txt
45+ - cd logs && ls -la
46+
47+ - name : notify
48+ image : signalwire/drone-notify
49+ pull : always
50+ environment :
51+ SLACK_WEBHOOK_URL :
52+ from_secret : slack_webhook_url
53+ ENV_FILE :
54+ from_secret : notify_env
55+ commands :
56+ - /root/unit-tests-notify.sh
57+
58+ trigger :
59+ branch :
60+ - master
61+ event :
62+ - pull_request
63+ - push
64+
165---
266kind : pipeline
367name : scan-build
@@ -46,6 +110,6 @@ trigger:
46110
47111---
48112kind : signature
49- hmac : ac8a02442523f785e8d9eef2a667e664b3bd5ec12b858dcc6736518ea18ff266
113+ hmac : 7a77efc692a53c1574bce1f2f53aadda0610629195eb7e71916505a63545a557
50114
51115...
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # All output will be collected here
4+ TESTSUNITPATH=$PWD /tests/unit
5+
6+ failed_tests=$( find ./ -name * .trs | xargs grep FAIL -l)
7+ if [[ -n $failed_tests ]]
8+ then
9+ echo " FAILED TESTS $failed_tests "
10+ for test in $failed_tests
11+ do
12+ dir=" $( dirname " ${test} " ) "
13+ file=" $( basename " ${test} " ) "
14+ log=" $TESTSUNITPATH /log_run-tests_${dir// \/ /! } !$file .html" ;
15+ cat $dir /test-suite.log | ansi2html > $log
16+ done
17+ exit 1
18+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ echo " Collecting test logs"
4+ LOG_DIR=./logs
5+ html=" <html><h3>There are failed unit-tests:</h3><table>"
6+ logs=$( find $LOG_DIR -type f -iname " *.html" -print | sort)
7+ logs_found=0
8+ olddirname=" "
9+ for name in $logs
10+ do
11+ logname=$( basename $name )
12+ testname=$( echo $logname | awk -F ' log_run-tests_' ' {print $2}' | awk -F ' .html' ' {print $1}' )
13+ testpath=" ${testname//!/ \/ } "
14+ dirname=$( dirname $testpath )
15+ test=$( basename $testpath )
16+ if [ " $olddirname " != " $dirname " ]; then
17+ html+=" <tr align=\" left\" ><th><br>$dirname </th></tr>" ;
18+ olddirname=$dirname ;
19+ fi
20+ html+=" <tr align=\" left\" ><td><a href=" $logname " >$test </a>"
21+ backtrace=" backtrace_$testname .txt"
22+ if test -f " ${LOG_DIR} /$backtrace " ; then
23+ html+=" . Core dumped, backtrace is available <a href=\" $backtrace \" >here</a>"
24+ fi
25+ html+=" </td></tr>"
26+ logs_found=1
27+ done
28+
29+ if [ $logs_found -ne 0 ]; then
30+ html+=" </table></html>"
31+ echo $html > $LOG_DIR /artifacts.html
32+ exit 1
33+ fi
34+
35+ exit 0
You can’t perform that action at this time.
0 commit comments