[882] | 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
|
---|
[884] | 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
|
---|
[882] | 18 | cat nightly.log | grep NIGHTLYRUNTERMINATEDCORRECTLY > check.log
|
---|
[884] | 19 | cat nightly.log | grep ERROR | grep -v "PETSC ERROR" > errors.log
|
---|
[882] | 20 | cat nightly.log | grep SUCCESS > success.log
|
---|
| 21 | cat errors.log success.log > tests.log
|
---|
[942] | 22 | #mail -s "Nightly runs of $ISSM_RELEASE on: $host_name. Date:$today." mathieu.morlighem@jpl.nasa.gov < tests.log
|
---|
[882] | 23 |
|
---|
[884] | 24 | #build report.html
|
---|
[882] | 25 | cat <<END > report.html
|
---|
| 26 | <html>
|
---|
| 27 | <title>ISSM - Nightly run Report</title>
|
---|
| 28 | <body>
|
---|
| 29 |
|
---|
| 30 | <style type="text/css">
|
---|
| 31 | <!--
|
---|
[942] | 32 | .issmh1 {
|
---|
[882] | 33 | margin-top:1em;
|
---|
[942] | 34 | background: none;
|
---|
[882] | 35 | color: #6495ed;
|
---|
[942] | 36 | font-family: Arial, Verdana, Tahoma;
|
---|
| 37 | font-size: 35px;
|
---|
[882] | 38 | text-align: center;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
[942] | 41 | .issmh2 {
|
---|
[882] | 42 | margin-top:1.5em;
|
---|
[943] | 43 | width:800px;
|
---|
[882] | 44 | background: transparent;
|
---|
| 45 | color: #6495ed;
|
---|
[942] | 46 | font-family: Arial, Verdana, Tahoma;
|
---|
| 47 | font-size: 28px;
|
---|
[882] | 48 | text-align: left;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
[942] | 51 | .issmcomment
|
---|
[882] | 52 | {white-space:pre-wrap;
|
---|
| 53 | word-wrap:break-word;
|
---|
| 54 | padding:4px;
|
---|
[943] | 55 | width:800px;
|
---|
[882] | 56 | border:1px dashed #000000;
|
---|
[942] | 57 | text-align: left;
|
---|
| 58 | font-family: Arial, Verdana, Tahoma;
|
---|
| 59 | font-size: 14px;
|
---|
| 60 | color: #404040;
|
---|
[882] | 61 | background-color:#ffffdd}
|
---|
| 62 | -->
|
---|
| 63 | </style>
|
---|
[942] | 64 | <div align="center" style=" font-family:Arial,Verdana,Tahoma; font-size: 14px; color: #404040;">
|
---|
[882] | 65 | <br>
|
---|
[942] | 66 | <pre class="issmh1">ISSM Nightly run report</pre>
|
---|
[882] | 67 | <br>
|
---|
[942] | 68 | <pre class="issmcomment">
|
---|
[882] | 69 | host: $host_name
|
---|
| 70 | date: $today
|
---|
| 71 | release: $ISSM_RELEASE
|
---|
| 72 |
|
---|
[942] | 73 | status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ];
|
---|
[882] | 74 | then
|
---|
[942] | 75 | echo "<span style=\"color:#FF0000\">stopped before the end</span>"
|
---|
[882] | 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>
|
---|
[942] | 82 | <br>
|
---|
| 83 | <hr width="900px">
|
---|
[882] | 84 |
|
---|
| 85 | $(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do
|
---|
| 86 |
|
---|
| 87 | #enter title
|
---|
| 88 | if [ $package == "macayeal" ]; then
|
---|
[942] | 89 | echo "<pre class=\"issmh2\">MacAyeal package</pre>"
|
---|
[882] | 90 | fi
|
---|
| 91 | if [ $package == "ice" ]; then
|
---|
[942] | 92 | echo "<pre class=\"issmh2\">Ice package</pre>"
|
---|
[882] | 93 | fi
|
---|
| 94 | if [ $package == "cielo_serial" ]; then
|
---|
[942] | 95 | echo "<pre class=\"issmh2\">Cielo Serial package</pre>"
|
---|
[882] | 96 | fi
|
---|
| 97 | if [ $package == "cielo_parallel" ]; then
|
---|
[942] | 98 | echo "<pre class=\"issmh2\">Cielo Parallel package</pre>"
|
---|
[882] | 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 |
|
---|
[943] | 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>"
|
---|
[882] | 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
|
---|
[943] | 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);}';
|
---|
[882] | 124 | echo "</tr>"
|
---|
| 125 | done
|
---|
| 126 |
|
---|
| 127 | echo "</table>"
|
---|
| 128 | fi
|
---|
| 129 | rm $package.log
|
---|
| 130 | done)
|
---|
| 131 |
|
---|
| 132 | <br>
|
---|
[942] | 133 | <br>
|
---|
[882] | 134 | <center><small></a><a href="http://issm.jpl.nasa.gov" title="ISSM website" target="_blank">ISSM</a> nightly run report</small></center>
|
---|
[942] | 135 | </div>
|
---|
| 136 | </body>
|
---|
| 137 | </html>
|
---|
[882] | 138 | END
|
---|