mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
Add unit-tests automation to Drone CI
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Collecting test logs"
|
||||
LOG_DIR=./logs
|
||||
html="<html><h3>There are failed unit-tests:</h3><table>"
|
||||
html+="<tr align=\"left\"><th><br>Unit tests</th></tr>"
|
||||
logs=$(find $LOG_DIR -type f -iname "*.html" -print)
|
||||
logs_found=0
|
||||
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>"
|
||||
logs_found=1
|
||||
done
|
||||
|
||||
if [ $logs_found -ne 0 ]; then
|
||||
html+="</table></html>"
|
||||
echo $html > $LOG_DIR/artifacts.html
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
TESTS=$(make -f - 2>/dev/null <<EOF
|
||||
include Makefile
|
||||
all:
|
||||
@echo \$(TESTS)
|
||||
EOF
|
||||
)
|
||||
|
||||
echo "-----------------------------------------------------------------";
|
||||
echo "Starting tests";
|
||||
echo "Tests found: ${TESTS}";
|
||||
echo "-----------------------------------------------------------------";
|
||||
for i in $TESTS
|
||||
do
|
||||
echo "Testing $i" ;
|
||||
logfilename="log_run-tests_$i.html";
|
||||
./$i | tee >(ansi2html > $logfilename) ;
|
||||
exitstatus=${PIPESTATUS[0]} ;
|
||||
if [ "0" -eq $exitstatus ] ; then
|
||||
rm $logfilename ;
|
||||
else
|
||||
echo "*** ./$i exit status is $exitstatus" ;
|
||||
echo "*** $logfilename was saved" ;
|
||||
fi ;
|
||||
echo "----------------" ;
|
||||
done
|
||||
Reference in New Issue
Block a user