10 |
echo |
echo |
11 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
12 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
13 |
echo " (-optfile=|-of=)STRING list of genmake2 \"optfiles\"" |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
14 |
echo " (-a|-addr)STRING list of email recipients" |
echo " (-a|-addr)STRING list of email recipients" |
15 |
echo " (-t|-tdir)STRING list of \"test\" dirs" |
echo " (DEF=\"edhill@mitgcm.org\")" |
16 |
|
echo " (-t|-tdir)STRING list of test dirs to use" |
17 |
|
echo " (DEF=\"\" which builds all)" |
18 |
|
echo " (-b|-bash)STRING location of \"bash\" executable" |
19 |
|
echo " (DEF=\"\" for \"/bin/bash\")" |
20 |
|
echo " (-c|-command)STRING command to run" |
21 |
|
echo " (DEF=\"make output.txt\")" |
22 |
|
echo |
23 |
|
echo "and where STRING follows a whitespace-delimited format" |
24 |
|
echo "such as:" |
25 |
|
echo " -t 'exp0 exp2 exp3' " |
26 |
|
echo " -addr='abc@123.com testing@home.org'" |
27 |
echo |
echo |
28 |
exit 1 |
exit 1 |
29 |
} |
} |
171 |
genmakemodel() |
genmakemodel() |
172 |
{ |
{ |
173 |
# genmakemodel directory |
# genmakemodel directory |
174 |
GENMAKE2="../../../tools/genmake2" |
GENMAKE2="$BASH ../../../tools/genmake2" |
175 |
( |
( |
176 |
cd $1; |
cd $1; |
177 |
printf 'genmake ... ' 1>&2 |
printf 'genmake ... ' 1>&2 |
199 |
# makeclean directory |
# makeclean directory |
200 |
( |
( |
201 |
cd $1; |
cd $1; |
202 |
rm -f output.txt |
if test -e output.txt ; then |
203 |
|
rm -f output.txt |
204 |
|
fi |
205 |
printf 'make CLEAN ... ' 2>&1 |
printf 'make CLEAN ... ' 2>&1 |
206 |
if test -r Makefile ; then |
if test -r Makefile ; then |
207 |
make CLEAN >> make.log 2>&1 |
make CLEAN >> make.log 2>&1 |
270 |
|
|
271 |
runmodel() |
runmodel() |
272 |
{ |
{ |
273 |
# runmodel directory exe |
# runmodel directory |
274 |
# |
# |
275 |
# runs the model "exe" in "directory" (exe is relative to directory) |
# runs "$COMMAND" in "directory" |
276 |
|
# (where "$COMMAND" is relative to "directory") |
277 |
( |
( |
278 |
cd $1 |
cd $1 |
279 |
if [ -x $2 ]; then |
printf 'runmodel: ' 1>&2 |
280 |
if [ $quick -eq 0 ]; then |
# make output.txt |
281 |
rm -f output.txt |
$COMMAND |
282 |
fi |
RETVAL=$? |
283 |
printf 'runmodel: ' 1>&2 |
if test "x$RETVAL" = x0 ; then |
284 |
make output.txt |
cp output.txt $CDIR"/output.txt" |
285 |
RETVAL=$? |
return 0 |
286 |
if test "x$RETVAL" = x0 ; then |
else |
287 |
cp output.txt $CDIR"/output.txt" |
return 1 |
|
return 0 |
|
|
else |
|
|
return 1 |
|
|
fi |
|
288 |
fi |
fi |
289 |
) |
) |
290 |
} |
} |
325 |
return 0 |
return 0 |
326 |
else |
else |
327 |
echo |
echo |
328 |
echo "createcodelet: failed to compile codelet" | tee |
echo "createcodelet: failed to compile codelet" |
329 |
exit 1 |
exit 1 |
330 |
fi |
fi |
331 |
} |
} |
393 |
# Default properties |
# Default properties |
394 |
debug=0 |
debug=0 |
395 |
verbose=1 |
verbose=1 |
|
quick=0 |
|
396 |
clean=0 |
clean=0 |
|
ieee=1 |
|
397 |
expts='' |
expts='' |
398 |
|
# ieee=1 |
399 |
|
# quick=0 |
400 |
|
|
401 |
|
BASH= |
402 |
OPTFILES= |
OPTFILES= |
403 |
ADDRESSES=edhill@mitgcm.org |
ADDRESSES=edhill@mitgcm.org |
404 |
TESTDIRS= |
TESTDIRS= |
405 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
406 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
407 |
|
COMMAND="make output.txt" |
408 |
|
|
409 |
echo -n "parsing options... " |
echo -n "parsing options... " |
410 |
|
|
440 |
-tdir=* | --tdir=*) |
-tdir=* | --tdir=*) |
441 |
TESTDIRS=$ac_optarg ;; |
TESTDIRS=$ac_optarg ;; |
442 |
|
|
443 |
-quick) quick=1 ;; |
-bash | --bash | -b | --b) |
444 |
|
ac_prev=BASH ;; |
445 |
|
-bash=* | --bash=*) |
446 |
|
BASH=$ac_optarg ;; |
447 |
|
|
448 |
|
-command | --command | -c | --c) |
449 |
|
ac_prev=COMMAND ;; |
450 |
|
-command=* | --command=*) |
451 |
|
COMMAND=$ac_optarg ;; |
452 |
|
|
453 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
454 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
455 |
-clean) clean=1 ;; |
-clean) clean=1 ;; |
|
-noieee) ieee=0 ;; |
|
456 |
-quiet) verbose=0 ;; |
-quiet) verbose=0 ;; |
457 |
|
|
458 |
-*) |
-*) |
525 |
|
|
526 |
# ...and each test directory... |
# ...and each test directory... |
527 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
528 |
|
|
529 |
|
# Verify that the testdir exists and contains previous |
530 |
|
# results in the correct location--or skip this directory! |
531 |
|
if test ! -r $dir"/results/output.txt" ; then |
532 |
|
echo | tee -a $SUMMARY |
533 |
|
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
534 |
|
| tee -a $SUMMARY |
535 |
|
continue |
536 |
|
fi |
537 |
|
|
538 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
539 |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
CDIR=$DRESULTS"/"$DRESULTS"_"$NDIR |
559 |
rundir=input |
rundir=input |
560 |
fi |
fi |
561 |
|
|
|
# Verify that the testdir exists and contains previous |
|
|
# results in the correct location--or skip this directory! |
|
|
if test ! -r $dir"/results/output.txt" ; then |
|
|
echo | tee $SUMMARY |
|
|
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" \ |
|
|
| tee $SUMMARY |
|
|
continue |
|
|
fi |
|
|
|
|
562 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
563 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
564 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
565 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
566 |
&& linkdata $seperatebuilddir $dir/$rundir \ |
&& linkdata $seperatebuilddir $dir/$rundir \ |
567 |
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
&& runmodel $dir/$builddir && run=Y \ |
568 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput $dir $rundir` |
569 |
echo |
echo |
570 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} \ |