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

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

some improvments

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