| 1 | 
edhill | 
1.1 | 
#! /usr/bin/env bash | 
| 2 | 
  | 
  | 
 | 
| 3 | 
  | 
  | 
# $Header: $ | 
| 4 | 
  | 
  | 
# | 
| 5 | 
  | 
  | 
#  The purpose of this script is to create HTML summaries of the | 
| 6 | 
  | 
  | 
#  directories produced by the "parse_emails" script. | 
| 7 | 
  | 
  | 
 | 
| 8 | 
  | 
  | 
 | 
| 9 | 
  | 
  | 
usage() | 
| 10 | 
  | 
  | 
{ | 
| 11 | 
  | 
  | 
    echo | 
| 12 | 
  | 
  | 
    echo "Usage:  $0 [OPTIONS]" | 
| 13 | 
  | 
  | 
    echo  | 
| 14 | 
  | 
  | 
    echo "where possible OPTIONS are:" | 
| 15 | 
  | 
  | 
    echo "  (-help|-h)           print usage" | 
| 16 | 
  | 
  | 
    echo "  (-date |-d )PERIOD   run for PERIOD=\"YYYY_MM\"" | 
| 17 | 
  | 
  | 
    echo "                         [def=\"$PERIOD\"]" | 
| 18 | 
  | 
  | 
    echo  | 
| 19 | 
  | 
  | 
    exit 1 | 
| 20 | 
  | 
  | 
} | 
| 21 | 
  | 
  | 
 | 
| 22 | 
  | 
  | 
# defaults | 
| 23 | 
  | 
  | 
PERIOD=`date +%Y`"_"`date +%m` | 
| 24 | 
  | 
  | 
 | 
| 25 | 
  | 
  | 
#  Parse options | 
| 26 | 
  | 
  | 
ac_prev= | 
| 27 | 
  | 
  | 
for ac_option ; do | 
| 28 | 
  | 
  | 
         | 
| 29 | 
  | 
  | 
    # If the previous option needs an argument, assign it. | 
| 30 | 
  | 
  | 
    if test -n "$ac_prev"; then | 
| 31 | 
  | 
  | 
        eval "$ac_prev=\$ac_option" | 
| 32 | 
  | 
  | 
        ac_prev= | 
| 33 | 
  | 
  | 
        continue | 
| 34 | 
  | 
  | 
    fi | 
| 35 | 
  | 
  | 
     | 
| 36 | 
  | 
  | 
    ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` | 
| 37 | 
  | 
  | 
     | 
| 38 | 
  | 
  | 
    case $ac_option in | 
| 39 | 
  | 
  | 
	 | 
| 40 | 
  | 
  | 
	-help | --help | -h | --h) | 
| 41 | 
  | 
  | 
	    usage ;; | 
| 42 | 
  | 
  | 
	 | 
| 43 | 
  | 
  | 
        -date | --date | -d | --d) | 
| 44 | 
  | 
  | 
            ac_prev=PERIOD ;; | 
| 45 | 
  | 
  | 
        --date=* | -date=*) | 
| 46 | 
  | 
  | 
            PERIOD=$ac_optarg ;; | 
| 47 | 
  | 
  | 
         | 
| 48 | 
  | 
  | 
        *) | 
| 49 | 
  | 
  | 
	    echo "Error: don't understand argument \"$ac_option\"" | 
| 50 | 
  | 
  | 
	    usage | 
| 51 | 
  | 
  | 
            ;; | 
| 52 | 
  | 
  | 
         | 
| 53 | 
  | 
  | 
     esac | 
| 54 | 
  | 
  | 
      | 
| 55 | 
  | 
  | 
done | 
| 56 | 
  | 
  | 
 | 
| 57 | 
  | 
  | 
INDIR="/u/u0/httpd/html/testing/results/$PERIOD" | 
| 58 | 
  | 
  | 
OUTDIR="/u/u0/httpd/html/testing/summary" | 
| 59 | 
  | 
  | 
OUTFILE=$OUTDIR"/summary_"$PERIOD".html" | 
| 60 | 
  | 
  | 
 | 
| 61 | 
  | 
  | 
 | 
| 62 | 
  | 
  | 
#  Create the summary file for $PERIOD | 
| 63 | 
  | 
  | 
echo -n "Creating the summary file for the period \"$PERIOD\" ...  " | 
| 64 | 
  | 
  | 
cat > $OUTFILE << EOF | 
| 65 | 
  | 
  | 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 
| 66 | 
  | 
  | 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
| 67 | 
  | 
  | 
 | 
| 68 | 
  | 
  | 
<html xmlns="http://www.w3.org/1999/xhtml"> | 
| 69 | 
  | 
  | 
  <head> | 
| 70 | 
  | 
  | 
    <title>MITgcm testing summary</title> | 
| 71 | 
  | 
  | 
    <meta name="author" content="Ed Hill" /> | 
| 72 | 
  | 
  | 
    <base href="http://mitgcm.org/testing/summary/" /> | 
| 73 | 
  | 
  | 
  </head> | 
| 74 | 
  | 
  | 
  <body> | 
| 75 | 
  | 
  | 
    <table cellpadding="0" cellspacing="0" border="0" width="100%"> | 
| 76 | 
  | 
  | 
 | 
| 77 | 
  | 
  | 
EOF | 
| 78 | 
  | 
  | 
 | 
| 79 | 
  | 
  | 
# all_files=`find $INDIR -name summary.txt` | 
| 80 | 
  | 
  | 
all_files=`( cd $INDIR ; find . -name summary.txt )` | 
| 81 | 
  | 
  | 
 | 
| 82 | 
  | 
  | 
for f in $all_files ; do | 
| 83 | 
  | 
  | 
 | 
| 84 | 
  | 
  | 
    file=$INDIR"/"${f/.\//} | 
| 85 | 
  | 
  | 
    grep "^fresults" $file > /dev/null 2>&1 | 
| 86 | 
  | 
  | 
    RETVAL=$? | 
| 87 | 
  | 
  | 
    if test "x$RETVAL" != x0 ; then | 
| 88 | 
  | 
  | 
	continue | 
| 89 | 
  | 
  | 
    fi | 
| 90 | 
  | 
  | 
 | 
| 91 | 
  | 
  | 
    url=`echo $file | sed -e 's|/u/edhill/www|http://mitgcm.org/~edhill|'` | 
| 92 | 
  | 
  | 
    url=`echo $url | sed -e 's|summary.txt||'` | 
| 93 | 
  | 
  | 
    MACH= | 
| 94 | 
  | 
  | 
    fresults= | 
| 95 | 
  | 
  | 
    color="#eeeeee" | 
| 96 | 
  | 
  | 
 | 
| 97 | 
  | 
  | 
    source $file | 
| 98 | 
  | 
  | 
    echo $fresults | grep FAIL > /dev/null 2>&1 | 
| 99 | 
  | 
  | 
    if test "x$?" = x0 ; then | 
| 100 | 
  | 
  | 
        color="#ff99ff" | 
| 101 | 
  | 
  | 
    fi | 
| 102 | 
  | 
  | 
    echo $fresults | grep pass > /dev/null 2>&1 | 
| 103 | 
  | 
  | 
    if test "x$?" = x0 ; then | 
| 104 | 
  | 
  | 
        color="#99ffff" | 
| 105 | 
  | 
  | 
    fi | 
| 106 | 
  | 
  | 
 | 
| 107 | 
  | 
  | 
    gm_state=`echo $file | sed -e 's/summary.txt/genmake_state/g'` | 
| 108 | 
  | 
  | 
    if test -r $gm_state ; then | 
| 109 | 
  | 
  | 
	grep '^OPTFILE=' $gm_state > ./tmp_state | 
| 110 | 
  | 
  | 
	source ./tmp_state | 
| 111 | 
  | 
  | 
    else | 
| 112 | 
  | 
  | 
	optfile="unknown" | 
| 113 | 
  | 
  | 
    fi | 
| 114 | 
  | 
  | 
    optfile=`echo $OPTFILE | awk -F '/' '{print $NF}'` | 
| 115 | 
  | 
  | 
 | 
| 116 | 
  | 
  | 
    echo "<tr bgcolor=\"$color\">" >> $OUTFILE | 
| 117 | 
  | 
  | 
    echo "<td height=\"0\">$MACH</td>" >> $OUTFILE | 
| 118 | 
  | 
  | 
    echo "<td><a href=\"$url\">$DATE</a></td>" >> $OUTFILE | 
| 119 | 
  | 
  | 
    for i in $fresults ; do | 
| 120 | 
  | 
  | 
        if test "x$i" = xN ; then | 
| 121 | 
  | 
  | 
            echo -n "<td bgcolor=\"#ff6666\">$i</td>" >> $OUTFILE | 
| 122 | 
  | 
  | 
        else | 
| 123 | 
  | 
  | 
	    echo -n "<td>$i</td>" >> $OUTFILE | 
| 124 | 
  | 
  | 
	fi | 
| 125 | 
  | 
  | 
    done | 
| 126 | 
  | 
  | 
    echo "<td>$optfile</td>" >> $OUTFILE | 
| 127 | 
  | 
  | 
    echo "</tr>" >> $OUTFILE | 
| 128 | 
  | 
  | 
 | 
| 129 | 
  | 
  | 
done | 
| 130 | 
  | 
  | 
 | 
| 131 | 
  | 
  | 
cat >> $OUTFILE << EOF | 
| 132 | 
  | 
  | 
 | 
| 133 | 
  | 
  | 
    </table> | 
| 134 | 
  | 
  | 
  </body> | 
| 135 | 
  | 
  | 
</html> | 
| 136 | 
  | 
  | 
 | 
| 137 | 
  | 
  | 
EOF | 
| 138 | 
  | 
  | 
 | 
| 139 | 
  | 
  | 
chmod a+r $OUTFILE | 
| 140 | 
  | 
  | 
echo "done" | 
| 141 | 
  | 
  | 
 | 
| 142 | 
  | 
  | 
 | 
| 143 | 
  | 
  | 
#  Create the "latest" links | 
| 144 | 
  | 
  | 
echo "Creating the \"latest\" file for each machine: " | 
| 145 | 
  | 
  | 
LATEST=$OUTDIR"/latest_"$PERIOD".html" | 
| 146 | 
  | 
  | 
cat > $LATEST << EOF | 
| 147 | 
  | 
  | 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 
| 148 | 
  | 
  | 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
| 149 | 
  | 
  | 
 | 
| 150 | 
  | 
  | 
<html xmlns="http://www.w3.org/1999/xhtml"> | 
| 151 | 
  | 
  | 
  <head> | 
| 152 | 
  | 
  | 
    <title>MITgcm testing summary</title> | 
| 153 | 
  | 
  | 
    <meta name="author" content="Ed Hill" /> | 
| 154 | 
  | 
  | 
 | 
| 155 | 
  | 
  | 
    <!-- <base href="http://mitgcm.org/testing/summary/" /> --> | 
| 156 | 
  | 
  | 
 | 
| 157 | 
  | 
  | 
    <!-- Hinting for menu generation --> | 
| 158 | 
  | 
  | 
    <meta name="add_name_0" content="Source Code" /> | 
| 159 | 
  | 
  | 
    <meta name="add_name_1" content="Testing" /> | 
| 160 | 
  | 
  | 
    <meta name="add_name_2" content="" /> | 
| 161 | 
  | 
  | 
    <meta name="add_title" content="Testing" /> | 
| 162 | 
  | 
  | 
    <!-- Hinting for menu generation --> | 
| 163 | 
  | 
  | 
 | 
| 164 | 
  | 
  | 
  </head> | 
| 165 | 
  | 
  | 
  <body> | 
| 166 | 
  | 
  | 
    <p>The following are the most recent MITgcm testing runs for the  | 
| 167 | 
  | 
  | 
      time period <b>$PERIOD</b>.<br /><br /> | 
| 168 | 
  | 
  | 
      The machine naming scheme is:<br /></p> | 
| 169 | 
  | 
  | 
    <table align="center" border="0"> | 
| 170 | 
  | 
  | 
      <tr bgcolor="#00cccc"> <td><b>Machine</b></td> <td><b>"Nickname"</b></td> | 
| 171 | 
  | 
  | 
        <td><b>Notes</b></td> </tr> | 
| 172 | 
  | 
  | 
 | 
| 173 | 
  | 
  | 
      <tr bgcolor="#bbffdd"> <td>faulks.lcs.mit.edu</td> <td>"faulks"</td>  | 
| 174 | 
  | 
  | 
        <td>Red Hat 7.3 on an Intel P4 (the "original" testing machine)</td> </tr> | 
| 175 | 
  | 
  | 
      <tr bgcolor="#bbddff"> <td>shelley.lcs.mit.edu</td> <td>"shelley"</td> | 
| 176 | 
  | 
  | 
        <td>Red Hat 9 on an Intel P4</td> </tr> | 
| 177 | 
  | 
  | 
 | 
| 178 | 
  | 
  | 
      <tr bgcolor="#bbffdd"> <td>cg01.lcs.mit.edu cluster</td> <td>"myrinet"</td> | 
| 179 | 
  | 
  | 
        <td><a href="http://mitgcm.org/projects/MITGCM_CLUSTER/">MITgcm cluster facility | 
| 180 | 
  | 
  | 
        </a></td> </tr> | 
| 181 | 
  | 
  | 
      <tr bgcolor="#bbddff"> <td>Alpha cluster</td> <td>"halem"</td> | 
| 182 | 
  | 
  | 
        <td><a href="http://webserv.gsfc.nasa.gov/SCB/NCCS/systems/high-end-computing.html"> | 
| 183 | 
  | 
  | 
        NASA NCCS Halem</a></td> </tr> | 
| 184 | 
  | 
  | 
 | 
| 185 | 
  | 
  | 
      <tr bgcolor="#bbffdd"> <td> SGI Origin 2000 </td> <td>"hopper"</td> | 
| 186 | 
  | 
  | 
        <td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O2K/o2k.html"> | 
| 187 | 
  | 
  | 
        NAS SGI Origin 2000 </a></td> </tr> | 
| 188 | 
  | 
  | 
      <tr bgcolor="#bbddff"> <td> SGI Origin 3000 </td> <td>"lomax"</td> | 
| 189 | 
  | 
  | 
        <td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O3K/o3k.html"> | 
| 190 | 
  | 
  | 
        NAS SGI Origin 3000 </a></td> </tr> | 
| 191 | 
  | 
  | 
 | 
| 192 | 
  | 
  | 
      <tr bgcolor="#bbffdd"> <td> SGI Altix </td> <td>"orion"</td> | 
| 193 | 
  | 
  | 
        <td><a href="http://sc.jpl.nasa.gov/">JPL Supercomputing and  | 
| 194 | 
  | 
  | 
        Visualization Facility</a></td> </tr> | 
| 195 | 
  | 
  | 
      <tr bgcolor="#bbddff"> <td> IBM POWER3 SP </td> <td>"bf"</td> | 
| 196 | 
  | 
  | 
        <td><a href="http://www.scd.ucar.edu/computers/blackforest/">NCAR Blackforest | 
| 197 | 
  | 
  | 
        </a></td> </tr> | 
| 198 | 
  | 
  | 
 | 
| 199 | 
  | 
  | 
      <tr bgcolor="#bbffdd"> <td> IBM POWER4 SP </td> <td>"bs"</td> | 
| 200 | 
  | 
  | 
        <td><a href="http://www.scd.ucar.edu/computers/bluesky/">NCAR Bluesky | 
| 201 | 
  | 
  | 
        </a></td> </tr> | 
| 202 | 
  | 
  | 
 | 
| 203 | 
  | 
  | 
      <!-- | 
| 204 | 
  | 
  | 
      <tr bgcolor="#bbddff"> <td>  </td> <td>""</td> | 
| 205 | 
  | 
  | 
        <td></td> </tr> | 
| 206 | 
  | 
  | 
      --> | 
| 207 | 
  | 
  | 
 | 
| 208 | 
  | 
  | 
    </table> | 
| 209 | 
  | 
  | 
    <br /> | 
| 210 | 
  | 
  | 
    <table align="center" cellpadding="0" cellspacing="0" border="0" width="95%"> | 
| 211 | 
  | 
  | 
<tr bgcolor="#00cccc"> | 
| 212 | 
  | 
  | 
  <td height="0"> <b>"Nickname"</b> </td> | 
| 213 | 
  | 
  | 
  <td> <b>OPTFILE Name</b> </td> | 
| 214 | 
  | 
  | 
  <td> <b>Date (YYYYMMDD)</b> </td> | 
| 215 | 
  | 
  | 
</tr> | 
| 216 | 
  | 
  | 
 | 
| 217 | 
  | 
  | 
EOF | 
| 218 | 
  | 
  | 
 | 
| 219 | 
  | 
  | 
color="#bbffdd" | 
| 220 | 
  | 
  | 
res_url="http://mitgcm.org/testing/" | 
| 221 | 
  | 
  | 
 | 
| 222 | 
  | 
  | 
MACHINES="faulks shelley myrinet halem hopper lomax orion bf bs" | 
| 223 | 
  | 
  | 
 | 
| 224 | 
  | 
  | 
( cd $INDIR ; ls -1 ) > ./dir_all | 
| 225 | 
  | 
  | 
 | 
| 226 | 
  | 
  | 
for mname in $MACHINES ; do | 
| 227 | 
  | 
  | 
 | 
| 228 | 
  | 
  | 
    echo "  $mname" | 
| 229 | 
  | 
  | 
    if test "x$color" = x#bbffdd ; then | 
| 230 | 
  | 
  | 
	color="#bbddff" | 
| 231 | 
  | 
  | 
    else | 
| 232 | 
  | 
  | 
	color="#bbffdd" | 
| 233 | 
  | 
  | 
    fi | 
| 234 | 
  | 
  | 
 | 
| 235 | 
  | 
  | 
    dir_list=`grep $mname ./dir_all` | 
| 236 | 
  | 
  | 
    echo -n "" > ./mlist | 
| 237 | 
  | 
  | 
 | 
| 238 | 
  | 
  | 
    for i in $dir_list ; do | 
| 239 | 
  | 
  | 
 | 
| 240 | 
  | 
  | 
	dir=$INDIR"/"$i | 
| 241 | 
  | 
  | 
	OPTFILE= | 
| 242 | 
  | 
  | 
	if test -r $dir/summary.txt ; then | 
| 243 | 
  | 
  | 
	    comm=`grep 'OPTFILE=' $dir/summary.txt` | 
| 244 | 
  | 
  | 
	    eval $comm | 
| 245 | 
  | 
  | 
	    OPTFILE=${OPTFILE##*/} | 
| 246 | 
  | 
  | 
	fi | 
| 247 | 
  | 
  | 
	if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then | 
| 248 | 
  | 
  | 
	    comm=`grep 'OPTFILE=' $dir/genmake_state` | 
| 249 | 
  | 
  | 
	    eval $comm | 
| 250 | 
  | 
  | 
	    OPTFILE=${OPTFILE##*/} | 
| 251 | 
  | 
  | 
	fi | 
| 252 | 
  | 
  | 
	if test "x$OPTFILE" = x ; then | 
| 253 | 
  | 
  | 
	    comm=`grep '^# OPTFILE=' $dir/*/Makefile 2>/dev/null | head -1 | sed -e 's|^# ||'` | 
| 254 | 
  | 
  | 
	    eval $comm | 
| 255 | 
  | 
  | 
	    OPTFILE=${OPTFILE##*/} | 
| 256 | 
  | 
  | 
	fi | 
| 257 | 
  | 
  | 
	if test "x$OPTFILE" = x ; then | 
| 258 | 
  | 
  | 
	    OPTFILE="not_explicitly_specified" | 
| 259 | 
  | 
  | 
	fi | 
| 260 | 
  | 
  | 
	tokens=`echo $i | sed -e 's|_| |g'` | 
| 261 | 
  | 
  | 
	echo "" > ./ms_tmp | 
| 262 | 
  | 
  | 
	for tok in $tokens ; do | 
| 263 | 
  | 
  | 
	    echo $tok >> ./ms_tmp | 
| 264 | 
  | 
  | 
	done | 
| 265 | 
  | 
  | 
	DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,3)=="200")'` | 
| 266 | 
  | 
  | 
	rm -f ./ms_tmp | 
| 267 | 
  | 
  | 
	echo "$OPTFILE $DAY $i" >> ./mlist | 
| 268 | 
  | 
  | 
 | 
| 269 | 
  | 
  | 
    done | 
| 270 | 
  | 
  | 
 | 
| 271 | 
  | 
  | 
    # helpful for debugging | 
| 272 | 
  | 
  | 
    # cat ./mlist | 
| 273 | 
  | 
  | 
 | 
| 274 | 
  | 
  | 
    #  Do we have any data?  If so, create the latest pointer. | 
| 275 | 
  | 
  | 
    num=`wc -l ./mlist | awk '{print $1}'` | 
| 276 | 
  | 
  | 
    if test $num -gt 0 ; then | 
| 277 | 
  | 
  | 
	optfiles=`cat ./mlist | cut -d " " -f 1 | sort | uniq` | 
| 278 | 
  | 
  | 
 | 
| 279 | 
  | 
  | 
	for optf in $optfiles ; do | 
| 280 | 
  | 
  | 
	    ldir=`grep "^$optf " ./mlist | sort -r | head -1 | cut -d " " -f 3` | 
| 281 | 
  | 
  | 
	    URL="results/$PERIOD/$ldir" | 
| 282 | 
  | 
  | 
	    cat <<EOF >>$LATEST | 
| 283 | 
  | 
  | 
<tr bgcolor="$color"> | 
| 284 | 
  | 
  | 
  <td height="0"><a href="$res_url$URL"> $mname </a></td> | 
| 285 | 
  | 
  | 
  <td> $optf </td> | 
| 286 | 
  | 
  | 
  <td> $DAY </td> | 
| 287 | 
  | 
  | 
</tr> | 
| 288 | 
  | 
  | 
EOF | 
| 289 | 
  | 
  | 
	done | 
| 290 | 
  | 
  | 
    fi | 
| 291 | 
  | 
  | 
 | 
| 292 | 
  | 
  | 
done | 
| 293 | 
  | 
  | 
 | 
| 294 | 
  | 
  | 
cat >> $LATEST << EOF | 
| 295 | 
  | 
  | 
 | 
| 296 | 
  | 
  | 
    </table> | 
| 297 | 
  | 
  | 
  </body> | 
| 298 | 
  | 
  | 
</html> | 
| 299 | 
  | 
  | 
 | 
| 300 | 
  | 
  | 
EOF | 
| 301 | 
  | 
  | 
 | 
| 302 | 
  | 
  | 
rm -f ./dir_all ./mlist | 
| 303 | 
  | 
  | 
 | 
| 304 | 
  | 
  | 
CURR_PER=`date +%Y`"_"`date +%m` | 
| 305 | 
  | 
  | 
if test "x$PERIOD" = "x$CURR_PER" ; then | 
| 306 | 
  | 
  | 
    cp $LATEST ./results.xml | 
| 307 | 
  | 
  | 
    ( | 
| 308 | 
  | 
  | 
	cd $OUTDIR | 
| 309 | 
  | 
  | 
	rm -f latest.html | 
| 310 | 
  | 
  | 
	ln -s $LATEST latest.html | 
| 311 | 
  | 
  | 
    ) | 
| 312 | 
  | 
  | 
fi |