5.3.12
[infrastructure.git] / scripts / daily-test-summary.sh
index a22ba74..c71ccef 100755 (executable)
@@ -6,25 +6,36 @@ function manage () {
   pushd ~/manage >& /dev/null; git pull ; ./LocalSubstrate.inria.py "$@" ; popd >& /dev/null
 }
 
-subject="Tests summary for $(today)"
-to="build.onelab.eu"
+# can specify a finer-grain pattern if needed
+if [ -z "$1" ]; then pattern=$(today); else pattern="$1"; shift; fi
+
+subject="Tests summary for $pattern"
+to="build@onelab.eu"
 buildhost="build.onelab.eu"
-distro=onelab
+distro=lxc
 
 function builds () { manage -tv | grep $(today) | cut -d ' ' -f 3 ; }
 function add_links () {
     for build in $(builds); do
        echo $build | grep -q lxc && bdistro=lxc || bdistro=$distro
-       echo "http://$buildhost/$bdistro/$build/testlogs"
+       echo "http://$buildhost/$bdistro/$build/"
+       echo ""
     done
 }
 
+# for debugging
+#function sendmail () { cat ; }
+
 ( \
     echo "Subject: ${subject}" ; \
     echo "To: ${to}" ; \
-    cd ; \
-    echo "-------------------- Test results for $(today)" ; \
-    manage -tv | grep $(today) ; \
-    echo "-------------------- Shortcuts" ; \
-    add_links ; \
+    echo "-------------------- Test results for $pattern" ; \
+    manage -tv | grep $pattern | while read line; do
+       echo $line
+       # compute build and related distro
+       build=$(echo $line | cut -d' ' -f2)
+       echo $build | grep -q f14 && bdistro=onelab || bdistro=$distro
+       # write a one-line shorthand
+       echo "        http://$buildhost/$bdistro/$build/"
+    done
 ) | sendmail ${to}