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

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

test svn chmod

File size: 4.7 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>
85<br>
86status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
87then
88 echo "<span style=\"color:#FF0000\">stopped before the end</span>"
89else
90 echo "all test desks have been run"
91fi
92rm check.log)
93<br>
94number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)<br>
95number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}';rm success.log tests.log)</div>
96<br>
97<hr width="900px">
98
99$(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do
100
101 #enter title
102 if [ $package == "macayeal" ]; then
103 echo "<div class=\"issmh2\">MacAyeal package</div>"
104 fi
105 if [ $package == "ice" ]; then
106 echo "<div class=\"issmh2\">Ice package</div>"
107 fi
108 if [ $package == "cielo_serial" ]; then
109 echo "<div class=\"issmh2\">Cielo Serial package</div>"
110 fi
111 if [ $package == "cielo_parallel" ]; then
112 echo "<div class=\"issmh2\">Cielo Parallel package</div>"
113 fi
114
115 #Print division
116 echo "<div class=\"issmbody\">"
117
118 #check that at least one Test exists
119 if [ `wc -l $package.log | awk '{printf("%s",$1);}'` = "0" ]; then
120
121 #No Test: use a table to fix entourage bug.
122 echo "<table width=\"20%\" style=\"color:#FF0000; font-size:14px;\"><tr><td align=\"center\">No test found.</td></tr></table>"
123
124 else
125
126 echo "<table cellspacing=\"-1\" width=\"100%\" style=\"font-family: Arial, Verdana, Tahoma; color: #404040;\">"
127 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>"
128
129 # go through the lines of $package.log
130 COUNTER=0
131 MAX=`wc -l $package.log | awk '{printf("%s",$1);}'`
132 while [ $COUNTER -lt $MAX ]; do
133 let COUNTER=COUNTER+1
134
135 echo "<tr>"
136
137 #see wether it is success or error (get color: red or green)
138 if [ "`cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$COUNTER'o/ {printf("%s\n",$2);}';`" == "SUCCESS" ];
139 then
140 color="bgcolor=#ddffdd";
141 else
142 color="bgcolor=#ffdddd";
143 fi
144
145 #build html corresponding line
146 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);}';
147 echo "</tr>"
148 done
149
150 echo "</table>"
151 fi
152
153 #Print end division and remove log file
154 echo "</div>"
155 rm $package.log
156
157done)
158
159<br>
160<br>
161<div class="issmfooter"><a href="http://issm.jpl.nasa.gov" title="ISSM website" target="_blank">ISSM</a> nightly run report</div>
162</body>
163</html>
164END
Note: See TracBrowser for help on using the repository browser.