f37 -> f39
[infrastructure.git] / scripts / daily-test-summary.sh
1 #!/bin/bash
2
3 # extract from testmaster's convenience tools
4 function today () { date +%Y.%m.%d; }
5 function manage () {
6   pushd ~/manage >& /dev/null; git pull ; ./LocalSubstrate.inria.py "$@" ; popd >& /dev/null
7 }
8
9 # can specify a finer-grain pattern if needed
10 if [ -z "$1" ]; then pattern=$(today); else pattern="$1"; shift; fi
11
12 subject="Tests summary for $pattern"
13 to="build@onelab.eu"
14 buildhost="build.onelab.eu"
15 distro=lxc
16
17 function builds () { manage -tv | grep $(today) | cut -d ' ' -f 3 ; }
18 function add_links () {
19     for build in $(builds); do
20         echo $build | grep -q lxc && bdistro=lxc || bdistro=$distro
21         echo "http://$buildhost/$bdistro/$build/"
22         echo ""
23     done
24 }
25
26 # for debugging
27 #function sendmail () { cat ; }
28
29 ( \
30     echo "Subject: ${subject}" ; \
31     echo "To: ${to}" ; \
32     echo "-------------------- Test results for $pattern" ; \
33     manage -tv | grep $pattern | while read line; do
34         echo $line
35         # compute build and related distro
36         build=$(echo $line | cut -d' ' -f2)
37         echo $build | grep -q f14 && bdistro=onelab || bdistro=$distro
38         # write a one-line shorthand
39         echo "        http://$buildhost/$bdistro/$build/"
40     done
41 ) | sendmail ${to}