2019-11-21 13:43:28 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
echo "Collecting test logs"
|
|
|
|
LOG_DIR=./logs
|
|
|
|
html="<html><h3>There are failed unit-tests:</h3><table>"
|
2020-01-18 15:05:25 -05:00
|
|
|
logs=$(find $LOG_DIR -type f -iname "*.html" -print | sort)
|
2019-11-21 13:43:28 -05:00
|
|
|
logs_found=0
|
2020-01-18 15:05:25 -05:00
|
|
|
olddirname=""
|
2019-11-21 13:43:28 -05:00
|
|
|
for name in $logs
|
|
|
|
do
|
|
|
|
logname=$(basename $name)
|
|
|
|
testname=$(echo $logname | awk -F 'log_run-tests_' '{print $2}' | awk -F '.html' '{print $1}')
|
2020-01-18 15:05:25 -05:00
|
|
|
testpath="${testname//!/\/}"
|
|
|
|
dirname=$(dirname $testpath)
|
|
|
|
test=$(basename $testpath)
|
|
|
|
if [ "$olddirname" != "$dirname" ]; then
|
|
|
|
html+="<tr align=\"left\"><th><br>$dirname</th></tr>" ;
|
|
|
|
olddirname=$dirname ;
|
|
|
|
fi
|
|
|
|
html+="<tr align=\"left\"><td><a href="$logname">$test</a>"
|
2019-12-27 10:25:38 -05:00
|
|
|
backtrace="backtrace_$testname.txt"
|
|
|
|
if test -f "${LOG_DIR}/$backtrace"; then
|
2020-01-18 15:05:25 -05:00
|
|
|
html+=". Core dumped, backtrace is available <a href=\"$backtrace\">here</a>"
|
2019-12-27 10:25:38 -05:00
|
|
|
fi
|
|
|
|
html+="</td></tr>"
|
2019-11-21 13:43:28 -05:00
|
|
|
logs_found=1
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ $logs_found -ne 0 ]; then
|
|
|
|
html+="</table></html>"
|
|
|
|
echo $html > $LOG_DIR/artifacts.html
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|