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

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

minor

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