#!/bin/bash #generate html report from nightly.log output file #Process log for errors cat nightly.log | grep 'package: macayeal' | grep -v "not supported yet" > macayeal.log cat nightly.log | grep 'package: ice' | grep -v "not supported yet" > ice.log cat nightly.log | grep 'package: cielo_serial' | grep -v "not supported yet" > cielo_serial.log cat nightly.log | grep 'package: cielo_parallel'| grep -v "not supported yet" > cielo_parallel.log cat nightly.log | grep NIGHTLYRUNTERMINATEDCORRECTLY > check.log cat nightly.log | grep ERROR | grep -v "PETSC ERROR" > errors.log cat nightly.log | grep SUCCESS > success.log cat errors.log success.log > tests.log #build report.html cat < report.html ISSM - Nightly run Report
ISSM Nightly run report

date: $TODAY
host: $HOST_NAME
platform: $ISSM_ARCH
release: $ISSM_RELEASE

status: $(if [ `wc -l check.log | awk '{printf("%s",$1);}'` = "0" ]; then echo "stopped before the end" else echo "all test desks have been run" fi rm check.log)
number of errors: $(wc -l errors.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}'; rm errors.log)
number of success: $(wc -l success.log | awk '{printf("%s",$1);}')/$(wc -l tests.log | awk '{printf("%s",$1);}';rm success.log tests.log)


$(for package in "macayeal" "ice" "cielo_serial" "cielo_parallel"; do #enter title if [ $package == "macayeal" ]; then echo "
MacAyeal package
" fi if [ $package == "ice" ]; then echo "
Ice package
" fi if [ $package == "cielo_serial" ]; then echo "
Cielo Serial package
" fi if [ $package == "cielo_parallel" ]; then echo "
Cielo Parallel package
" fi #Print division echo "
" #check that at least one Test exists if [ `wc -l $package.log | awk '{printf("%s",$1);}'` = "0" ]; then #No Test: use a table to fix entourage bug. echo "
No test found.
" else echo "" echo "" # go through the lines of $package.log COUNTER=0 MAX=`wc -l $package.log | awk '{printf("%s",$1);}'` while [ $COUNTER -lt $MAX ]; do let COUNTER=COUNTER+1 echo "" #see wether it is success or error (get color: red or green) if [ "`cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$COUNTER'o/ {printf("%s\n",$2);}';`" == "SUCCESS" ]; then color="bgcolor=#ddffdd"; else color="bgcolor=#ffdddd"; fi #build html corresponding line cat $package.log | awk '{ printf "line%so %s\n", NR, $0 }' | awk '/line'$COUNTER'o/ {printf("",$2,$4,$5,$6,$8,$10,$14);}'; echo "" done echo "
Result Tolerance Test Solution Field
%s %s%s%s %s %s %s
" fi #Print end division and remove log file echo "
" rm $package.log done)

ISSM nightly run report
END