From d5378211600f47e71497bf33f3d910e045252005 Mon Sep 17 00:00:00 2001
From: Thierry Parmentelat <thierry.parmentelat@inria.fr>
Date: Sun, 5 May 2013 09:24:23 +0200
Subject: [PATCH] ore usable daily summary

---
 scripts/daily-test-summary.sh | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/scripts/daily-test-summary.sh b/scripts/daily-test-summary.sh
index 83fbd4f..eee3ed6 100755
--- a/scripts/daily-test-summary.sh
+++ b/scripts/daily-test-summary.sh
@@ -6,7 +6,10 @@ function manage () {
   pushd ~/manage >& /dev/null; git pull ; ./LocalSubstrate.inria.py "$@" ; popd >& /dev/null
 }
 
-subject="Tests summary for $(today)"
+# 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
@@ -15,16 +18,24 @@ 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 lxc && bdistro=lxc || bdistro=$distro
+	# write a one-line shorthand
+	echo "        http://$buildhost/$bdistro/$build/"
+    done
 ) | sendmail ${to}
-- 
2.47.0