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

Last change on this file since 944 was 944, checked in by Mathieu Morlighem, 17 years ago

minor

File size: 4.4 KB
Line 
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
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
18cat nightly.log | grep NIGHTLYRUNTERMINATEDCORRECTLY > check.log
19cat nightly.log | grep ERROR | grep -v "PETSC ERROR" > errors.log
20cat nightly.log | grep SUCCESS > success.log
21cat errors.log success.log > tests.log
22#mail -s "Nightly runs of $ISSM_RELEASE on: $host_name. Date:$today." mathieu.morlighem@jpl.nasa.gov < tests.log
23
24#build report.html
25cat <<END > report.html
26<html>
27<title>ISSM - Nightly run Report</title>
28<body>
29
30<style type="text/css">
31 <!--
32 .issmh1 {
33 margin-top:1em;
34 background: none;
35 color: #6495ed;
36 font-family: Arial, Verdana, Tahoma;
37 font-size: 35px;
38 font-weight: bold;
39 text-align: center;
40 }
41
42 .issmh2 {
43 margin-top:1.5em;
44 width:800px;
45 background: transparent;
46 color: #6495ed;
47 font-family: Arial, Verdana, Tahoma;
48 font-weight: bold;
49 font-size: 28px;
50 text-align: left;
51 }
52
53 .issmcomment
54 {white-space:pre-wrap;
55 word-wrap:break-word;
56 padding:4px;
57 width:800px;
58 border:1px dashed #000000;
59 text-align: left;
60 font-family: Arial, Verdana, Tahoma;
61 font-size: 14px;
62 color: #404040;
63 background-color:#ffffdd}
64 -->
65</style>
66<div align="center" style=" font-family:Arial,Verdana,Tahoma; font-size: 14px; color: #404040;">
67<br>
68<pre class="issmh1">ISSM Nightly run report</pre>
69<br>
70<pre class="issmcomment">
71host: $host_name
72date: $today
73release: $ISSM_RELEASE
74
75status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
76then
77 echo "<span style=\"color:#FF0000\">stopped before the end</span>"
78else
79 echo "all test desks have been run"
80fi
81rm check.log)
82number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)
83number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}';rm success.log tests.log)</pre>
84<br>
85<hr width="900px">
86
87$(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do
88
89 #enter title
90 if [ $package == "macayeal" ]; then
91 echo "<pre class=\"issmh2\">MacAyeal package</pre>"
92 fi
93 if [ $package == "ice" ]; then
94 echo "<pre class=\"issmh2\">Ice package</pre>"
95 fi
96 if [ $package == "cielo_serial" ]; then
97 echo "<pre class=\"issmh2\">Cielo Serial package</pre>"
98 fi
99 if [ $package == "cielo_parallel" ]; then
100 echo "<pre class=\"issmh2\">Cielo Parallel package</pre>"
101 fi
102
103 #check that at least one test exists
104 if [ `wc -l $package.log | awk '{printf("%s",$1);}'` = "0" ]; then
105 echo "&nbsp;&nbsp No test found."
106 else
107
108 echo "<table cellspacing=\"-1\" width=\"800px\" style=\"font-family: Arial, Verdana, Tahoma; color: #404040;\">"
109 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>"
110
111 # go through the lines of $package.log
112 for i in $(seq 1 1 `wc -l $package.log | awk '{printf("%s",$1);}'`); do
113
114 echo "<tr>"
115
116 #see wether it is success or error (get color: red or green)
117 if [ "`cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$i'o/ {printf("%s\n",$2);}';`" == "SUCCESS" ];
118 then
119 color="bgcolor=#ddffdd";
120 else
121 color="bgcolor=#ffdddd";
122 fi
123
124 #build html corresponding line
125 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);}';
126 echo "</tr>"
127 done
128
129 echo "</table>"
130 fi
131 rm $package.log
132done)
133
134 <br>
135 <br>
136 <center><small></a><a href="http://issm.jpl.nasa.gov" title="ISSM website" target="_blank">ISSM</a> nightly run report</small></center>
137 </div>
138 </body>
139 </html>
140END
Note: See TracBrowser for help on using the repository browser.