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