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

Last change on this file since 1074 was 1074, checked in by Mathieu Morlighem, 16 years ago

fixed report.sh if no test is found

File size: 4.9 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 <!--
[1074]32 .issmbody {
33 margin: auto;
34 width:800px;
35 background: none;
36 color: #404040;
37 font-family: Arial, Verdana, Tahoma;
38 font-size: 14px;
39 font-weight: normal;
40 text-align: left;
41 }
42
[942]43 .issmh1 {
[1074]44 margin:2em auto;
45 width:800px;
[942]46 background: none;
[882]47 color: #6495ed;
[942]48 font-family: Arial, Verdana, Tahoma;
49 font-size: 35px;
[944]50 font-weight: bold;
[882]51 text-align: center;
52 }
53
[942]54 .issmh2 {
[1074]55 margin:1.5em auto 1em auto;
[943]56 width:800px;
[882]57 background: transparent;
58 color: #6495ed;
[942]59 font-family: Arial, Verdana, Tahoma;
[944]60 font-weight: bold;
[942]61 font-size: 28px;
[882]62 text-align: left;
63 }
64
[1074]65 .issmfooter {
66 margin:auto;
67 width:800px;
68 background: none;
69 color: #404040;
70 font-family: Arial, Verdana, Tahoma;
71 font-size: 12px;
72 font-weight: normal;
73 text-align: center;
74 }
75
76 .issmcomment {
[882]77 padding:4px;
[1074]78 margin:0 auto;
[943]79 width:800px;
[882]80 border:1px dashed #000000;
[942]81 text-align: left;
82 font-family: Arial, Verdana, Tahoma;
83 font-size: 14px;
84 color: #404040;
[882]85 background-color:#ffffdd}
86 -->
87</style>
[1074]88<div class="issmh1">ISSM Nightly run report</div>
[882]89<br>
[1074]90<div class="issmcomment">
91host: $host_name<br>
92date: $today<br>
93release: $ISSM_RELEASE<br>
[882]94<br>
[942]95status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
[882]96then
[942]97 echo "<span style=\"color:#FF0000\">stopped before the end</span>"
[882]98else
99 echo "all test desks have been run"
100fi
101rm check.log)
[942]102<br>
[1074]103number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)<br>
104number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}';rm success.log tests.log)</div>
105<br>
[942]106<hr width="900px">
[882]107
108$(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do
109
110 #enter title
111 if [ $package == "macayeal" ]; then
[1074]112 echo "<div class=\"issmh2\">MacAyeal package</div>"
[882]113 fi
114 if [ $package == "ice" ]; then
[1074]115 echo "<div class=\"issmh2\">Ice package</div>"
[882]116 fi
117 if [ $package == "cielo_serial" ]; then
[1074]118 echo "<div class=\"issmh2\">Cielo Serial package</div>"
[882]119 fi
120 if [ $package == "cielo_parallel" ]; then
[1074]121 echo "<div class=\"issmh2\">Cielo Parallel package</div>"
[882]122 fi
123
[1074]124 #Print division
125 echo "<div class=\"issmbody\">"
126
127 #check that at least one Test exists
[882]128 if [ `wc -l $package.log | awk '{printf("%s",$1);}'` = "0" ]; then
[1074]129
130 #No Test: use a table to fix entourage bug.
131 echo "<table width=\"200px\" style=\"color:#FF0000; font-size:14px;\"><tr><td align=\"center\">No test found.</td></tr></table>"
132
[882]133 else
134
[943]135 echo "<table cellspacing=\"-1\" width=\"800px\" style=\"font-family: Arial, Verdana, Tahoma; color: #404040;\">"
136 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]137
138 # go through the lines of $package.log
139 for i in $(seq 1 1 `wc -l $package.log | awk '{printf("%s",$1);}'`); do
140
141 echo "<tr>"
142
143 #see wether it is success or error (get color: red or green)
144 if [ "`cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$i'o/ {printf("%s\n",$2);}';`" == "SUCCESS" ];
145 then
146 color="bgcolor=#ddffdd";
147 else
148 color="bgcolor=#ffdddd";
149 fi
150
151 #build html corresponding line
[943]152 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]153 echo "</tr>"
154 done
155
156 echo "</table>"
157 fi
[1074]158
159 #Print end division and remove log file
160 echo "</div>"
[882]161 rm $package.log
[1074]162
[882]163done)
164
[1074]165<br>
166<br>
167<div class="issmfooter"><a href="http://issm.jpl.nasa.gov" title="ISSM website" target="_blank">ISSM</a> nightly run report</div>
168</body>
169</html>
[882]170END
Note: See TracBrowser for help on using the repository browser.