| 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 | #mail -s "Nightly runs of $ISSM_RELEASE on: $host_name. Date:$today." mathieu.morlighem@jpl.nasa.gov < tests.log
|
|---|
| 14 |
|
|---|
| 15 | #build report.html
|
|---|
| 16 | cat <<END > report.html
|
|---|
| 17 | <html>
|
|---|
| 18 | <title>ISSM - Nightly run Report</title>
|
|---|
| 19 | <body>
|
|---|
| 20 |
|
|---|
| 21 | <style type="text/css">
|
|---|
| 22 | <!--
|
|---|
| 23 | .issmbody {
|
|---|
| 24 | margin: auto;
|
|---|
| 25 | width:800px;
|
|---|
| 26 | background: none;
|
|---|
| 27 | color: #404040;
|
|---|
| 28 | font-family: Arial, Verdana, Tahoma;
|
|---|
| 29 | font-size: 14px;
|
|---|
| 30 | font-weight: normal;
|
|---|
| 31 | text-align: left;
|
|---|
| 32 | }
|
|---|
| 33 |
|
|---|
| 34 | .issmh1 {
|
|---|
| 35 | margin:2em auto;
|
|---|
| 36 | width:800px;
|
|---|
| 37 | background: none;
|
|---|
| 38 | color: #6495ed;
|
|---|
| 39 | font-family: Arial, Verdana, Tahoma;
|
|---|
| 40 | font-size: 35px;
|
|---|
| 41 | font-weight: bold;
|
|---|
| 42 | text-align: center;
|
|---|
| 43 | }
|
|---|
| 44 |
|
|---|
| 45 | .issmh2 {
|
|---|
| 46 | margin:1.5em auto 1em auto;
|
|---|
| 47 | width:800px;
|
|---|
| 48 | background: transparent;
|
|---|
| 49 | color: #6495ed;
|
|---|
| 50 | font-family: Arial, Verdana, Tahoma;
|
|---|
| 51 | font-weight: bold;
|
|---|
| 52 | font-size: 28px;
|
|---|
| 53 | text-align: left;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | .issmfooter {
|
|---|
| 57 | margin:auto;
|
|---|
| 58 | width:800px;
|
|---|
| 59 | background: none;
|
|---|
| 60 | color: #404040;
|
|---|
| 61 | font-family: Arial, Verdana, Tahoma;
|
|---|
| 62 | font-size: 12px;
|
|---|
| 63 | font-weight: normal;
|
|---|
| 64 | text-align: center;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | .issmcomment {
|
|---|
| 68 | padding:4px;
|
|---|
| 69 | margin:0 auto;
|
|---|
| 70 | width:800px;
|
|---|
| 71 | border:1px dashed #000000;
|
|---|
| 72 | text-align: left;
|
|---|
| 73 | font-family: Arial, Verdana, Tahoma;
|
|---|
| 74 | font-size: 14px;
|
|---|
| 75 | color: #404040;
|
|---|
| 76 | background-color:#ffffdd}
|
|---|
| 77 | -->
|
|---|
| 78 | </style>
|
|---|
| 79 | <div class="issmh1">ISSM Nightly run report</div>
|
|---|
| 80 | <br>
|
|---|
| 81 | <div class="issmcomment">
|
|---|
| 82 | date: $TODAY<br>
|
|---|
| 83 | host: $HOST_NAME<br>
|
|---|
| 84 | platform: $ISSM_ARCH<br>
|
|---|
| 85 | release: $ISSM_RELEASE<br>
|
|---|
| 86 | <br>
|
|---|
| 87 | status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
|
|---|
| 88 | then
|
|---|
| 89 | echo "<span style=\"color:#FF0000\">stopped before the end</span>"
|
|---|
| 90 | else
|
|---|
| 91 | echo "all test desks have been run"
|
|---|
| 92 | fi
|
|---|
| 93 | rm check.log)
|
|---|
| 94 | <br>
|
|---|
| 95 | number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)<br>
|
|---|
| 96 | 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>
|
|---|
| 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 |
|
|---|
| 158 | done)
|
|---|
| 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>
|
|---|
| 165 | END
|
|---|