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

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

some improvments

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