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