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

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

change output string

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