source: issm/trunk/cron/report.sh@ 944

Last change on this file since 944 was 944, checked in by Mathieu Morlighem, 17 years ago

minor

File size: 4.4 KB
RevLine 
[882]1#!/bin/bash
2#generate html report from nightly.log output file
3
4#get some variables
5function today_date {
6suffix=`date | awk '{printf("%s-%s-%s %s",$2,$3,$6,$4);}'`
7echo $suffix;
8}
9ISSM_RELEASE="issm";
10today=`today_date`;
11host_name=`hostname`;
12
13#Process log for errors
[884]14cat nightly.log | grep 'package: macayeal' | grep -v "not supported yet" > macayeal.log
15cat nightly.log | grep 'package: ice' | grep -v "not supported yet" > ice.log
16cat nightly.log | grep 'package: cielo_serial' | grep -v "not supported yet" > cielo_serial.log
17cat nightly.log | grep 'package: cielo_parallel'| grep -v "not supported yet" > cielo_parallel.log
[882]18cat nightly.log | grep NIGHTLYRUNTERMINATEDCORRECTLY > check.log
[884]19cat nightly.log | grep ERROR | grep -v "PETSC ERROR" > errors.log
[882]20cat nightly.log | grep SUCCESS > success.log
21cat errors.log success.log > tests.log
[942]22#mail -s "Nightly runs of $ISSM_RELEASE on: $host_name. Date:$today." mathieu.morlighem@jpl.nasa.gov < tests.log
[882]23
[884]24#build report.html
[882]25cat <<END > report.html
26<html>
27<title>ISSM - Nightly run Report</title>
28<body>
29
30<style type="text/css">
31 <!--
[942]32 .issmh1 {
[882]33 margin-top:1em;
[942]34 background: none;
[882]35 color: #6495ed;
[942]36 font-family: Arial, Verdana, Tahoma;
37 font-size: 35px;
[944]38 font-weight: bold;
[882]39 text-align: center;
40 }
41
[942]42 .issmh2 {
[882]43 margin-top:1.5em;
[943]44 width:800px;
[882]45 background: transparent;
46 color: #6495ed;
[942]47 font-family: Arial, Verdana, Tahoma;
[944]48 font-weight: bold;
[942]49 font-size: 28px;
[882]50 text-align: left;
51 }
52
[942]53 .issmcomment
[882]54 {white-space:pre-wrap;
55 word-wrap:break-word;
56 padding:4px;
[943]57 width:800px;
[882]58 border:1px dashed #000000;
[942]59 text-align: left;
60 font-family: Arial, Verdana, Tahoma;
61 font-size: 14px;
62 color: #404040;
[882]63 background-color:#ffffdd}
64 -->
65</style>
[942]66<div align="center" style=" font-family:Arial,Verdana,Tahoma; font-size: 14px; color: #404040;">
[882]67<br>
[942]68<pre class="issmh1">ISSM Nightly run report</pre>
[882]69<br>
[942]70<pre class="issmcomment">
[882]71host: $host_name
72date: $today
73release: $ISSM_RELEASE
74
[942]75status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
[882]76then
[942]77 echo "<span style=\"color:#FF0000\">stopped before the end</span>"
[882]78else
79 echo "all test desks have been run"
80fi
81rm check.log)
82number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)
83number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}';rm success.log tests.log)</pre>
[942]84<br>
85<hr width="900px">
[882]86
87$(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do
88
89 #enter title
90 if [ $package == "macayeal" ]; then
[942]91 echo "<pre class=\"issmh2\">MacAyeal package</pre>"
[882]92 fi
93 if [ $package == "ice" ]; then
[942]94 echo "<pre class=\"issmh2\">Ice package</pre>"
[882]95 fi
96 if [ $package == "cielo_serial" ]; then
[942]97 echo "<pre class=\"issmh2\">Cielo Serial package</pre>"
[882]98 fi
99 if [ $package == "cielo_parallel" ]; then
[942]100 echo "<pre class=\"issmh2\">Cielo Parallel package</pre>"
[882]101 fi
102
103 #check that at least one test exists
104 if [ `wc -l $package.log | awk '{printf("%s",$1);}'` = "0" ]; then
105 echo "&nbsp;&nbsp No test found."
106 else
107
[943]108 echo "<table cellspacing=\"-1\" width=\"800px\" style=\"font-family: Arial, Verdana, Tahoma; color: #404040;\">"
109 echo "<tr> <th style=\"font-size:14px;\">Result</th> <th style=\"font-size:14px;\">Tolerance</th> <th style=\"font-size:14px;\">Test</th> <th style=\"font-size:14px;\">Solution</th> <th style=\"font-size:14px;\">Field</th> </tr>"
[882]110
111 # go through the lines of $package.log
112 for i in $(seq 1 1 `wc -l $package.log | awk '{printf("%s",$1);}'`); do
113
114 echo "<tr>"
115
116 #see wether it is success or error (get color: red or green)
117 if [ "`cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$i'o/ {printf("%s\n",$2);}';`" == "SUCCESS" ];
118 then
119 color="bgcolor=#ddffdd";
120 else
121 color="bgcolor=#ffdddd";
122 fi
123
124 #build html corresponding line
[943]125 cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$i'o/ {printf("<td '$color' style=\"font-size:14px;\">%s</td><td '$color' style=\"font-size:14px;\"> %s%s%s</td><td '$color' style=\"font-size:14px;\"> %s</td><td '$color' style=\"font-size:14px;\"> %s</td><td '$color' style=\"font-size:14px;\"> %s</td>",$2,$4,$5,$6,$8,$10,$14);}';
[882]126 echo "</tr>"
127 done
128
129 echo "</table>"
130 fi
131 rm $package.log
132done)
133
134 <br>
[942]135 <br>
[882]136 <center><small></a><a href="http://issm.jpl.nasa.gov" title="ISSM website" target="_blank">ISSM</a> nightly run report</small></center>
[942]137 </div>
138 </body>
139 </html>
[882]140END
Note: See TracBrowser for help on using the repository browser.