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