| 3 |
# $Header$ |
# $Header$ |
| 4 |
# $Name$ |
# $Name$ |
| 5 |
|
|
| 6 |
|
#------------------------------------------------------------------------------- |
| 7 |
|
#-- process argument list: |
| 8 |
if test $# = 0 ; then |
if test $# = 0 ; then |
| 9 |
echo 'need 1 argument' |
echo 'need 1 argument' |
| 10 |
exit |
exit |
| 17 |
elif test $1 = gfort ; then |
elif test $1 = gfort ; then |
| 18 |
tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4' |
tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4' |
| 19 |
# tst_list="$tst_list g77 g7a" |
# tst_list="$tst_list g77 g7a" |
| 20 |
|
elif test $1 = tap ; then |
| 21 |
|
tst_list='tapAD tapTL' |
| 22 |
elif test $1 = gfor8 ; then |
elif test $1 = gfor8 ; then |
| 23 |
# tst_list='gadm gads gmp2 gmpi gfo g77' |
# tst_list='gadm gads gmp2 gmpi gfo g77' |
| 24 |
tst_list='gadm gads gmp2 gfo' |
tst_list='gadm gads gmp2 gfo' |
| 28 |
tst_list=$* |
tst_list=$* |
| 29 |
fi |
fi |
| 30 |
fi |
fi |
|
echo "run: \""`basename $0` $*"\" on:" `date` |
|
|
echo " tst_list='$tst_list'" |
|
| 31 |
|
|
| 32 |
#- to get ~/bin in the patch (for staf) when run on cron: |
#------------------------------------------------------------------------------- |
| 33 |
if [ -d ~/bin ]; then |
#-- general setting + MITgcm ref clone update: |
| 34 |
echo 'add ~/bin to $PATH' |
# |
|
export PATH=$PATH:~/bin |
|
|
fi |
|
| 35 |
#- to get case insensitive "ls" (and order of tested experiments) |
#- to get case insensitive "ls" (and order of tested experiments) |
| 36 |
#export LC_ALL="en_US.UTF-8" |
#export LC_ALL="en_US.UTF-8" |
| 37 |
#- Turn off stack limit for FIZHI & AD-tests |
#- Turn off stack limit for FIZHI & AD-tests |
| 43 |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
| 44 |
#- other settings: |
#- other settings: |
| 45 |
tmpFil="/tmp/"`basename $0`".$$" |
tmpFil="/tmp/"`basename $0`".$$" |
| 46 |
|
logFile='check_update.log' |
| 47 |
sendCmd='-a jm_c@mitgcm.org' |
sendCmd='-a jm_c@mitgcm.org' |
| 48 |
sendCmd='-send scp -a jm_c@mitgcm.org:testing/MITgcm-test' |
sendCmd='-send scp -a jm_c@mitgcm.org:testing/MITgcm-test' |
| 49 |
|
|
| 50 |
#-- for now, cannot mix ifort/gfortran tests: |
echo "-- run: \""`basename $0` $*"\" on:" `date` >> $logFile |
| 51 |
|
gcmDIR="MITgcm" |
| 52 |
|
if test -e $gcmDIR/.git/config ; then : ; else |
| 53 |
|
echo " No current clone ==> get a fresh clone" >> $logFile |
| 54 |
|
#rm -f git_Hash prevHash |
| 55 |
|
if test -d $gcmDIR ; then /bin/rm -rf $gcmDIR ; fi |
| 56 |
|
git clone https://github.com/$git_repo/${git_code}.git $gcmDIR |
| 57 |
|
( cd $gcmDIR ; git rev-parse HEAD > ../git_Hash ) |
| 58 |
|
fi |
| 59 |
|
|
| 60 |
|
#------------------------------------------------------------------------------- |
| 61 |
|
#-- check particular set of tests: |
| 62 |
|
if test $1 = tap ; then |
| 63 |
|
#- Only run this pair of test if MITgcm code got updated: |
| 64 |
|
if test -f git_Hash -a -f prevHash ; then |
| 65 |
|
#ls -l prevHash >> $logFile |
| 66 |
|
diff -q git_Hash prevHash > /dev/null 2>&1 |
| 67 |
|
retv=$? |
| 68 |
|
if test $retv = 0 ; then |
| 69 |
|
echo " No update in repos since previous test ==> skip '$1' set of tests" >> $logFile |
| 70 |
|
exit 0 |
| 71 |
|
else |
| 72 |
|
echo " Will run '$1' set of tests since repos has been updated" >> $logFile |
| 73 |
|
echo -n ' prevHash: ' >> $logFile |
| 74 |
|
cat prevHash >> $logFile |
| 75 |
|
echo -n ' git_Hash: ' >> $logFile |
| 76 |
|
cat git_Hash >> $logFile |
| 77 |
|
fi |
| 78 |
|
else |
| 79 |
|
echo " No file 'prevHash' --> will run '$1' set of tests" >> $logFile |
| 80 |
|
fi |
| 81 |
|
elif test $1 = gfort ; then |
| 82 |
|
#- to force to skip "tap" test while "gfort" is running: |
| 83 |
|
if test -f prevHash ; then |
| 84 |
|
cp -p prevHash git_Hash |
| 85 |
|
else |
| 86 |
|
cp -p git_Hash prevHash |
| 87 |
|
fi |
| 88 |
|
fi |
| 89 |
|
|
| 90 |
|
echo "run: \""`basename $0` $*"\" on:" `date` |
| 91 |
|
echo " tst_list='$tst_list'" |
| 92 |
|
|
| 93 |
|
#- to get ~/bin in the patch (for staf) when run on cron: |
| 94 |
|
if [ -d ~/bin ]; then |
| 95 |
|
echo 'add ~/bin to $PATH' |
| 96 |
|
export PATH=$PATH:~/bin |
| 97 |
|
#- and for Tapenade: |
| 98 |
|
echo $tst_list | grep '\<tap' > /dev/null 2>&1 ; retv=$? |
| 99 |
|
if test $retv = 0 ; then |
| 100 |
|
source ~jmc/bin/set_tapenade.sh |
| 101 |
|
fi |
| 102 |
|
fi |
| 103 |
|
|
| 104 |
|
#- for now, cannot mix ifort/gfortran tests: |
| 105 |
gfort=1 |
gfort=1 |
| 106 |
for tt in $tst_list |
for tt in $tst_list |
| 107 |
do |
do |
| 108 |
echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$? |
echo $tt | grep '^tap' > /dev/null 2>&1 ; retv=$? |
| 109 |
|
if [ $retv -ne 0 ] ; then |
| 110 |
|
echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$? |
| 111 |
|
fi |
| 112 |
if [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2 |
if [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2 |
| 113 |
elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0 |
elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0 |
| 114 |
else echo 'cannot mix ifort/gfortran' ; exit |
else echo 'cannot mix ifort/gfortran' ; exit |
| 125 |
source ~jmc/bin/openmpi.sh |
source ~jmc/bin/openmpi.sh |
| 126 |
fi |
fi |
| 127 |
|
|
| 128 |
#-------------------------------------------------------------------- |
#------------------------------------------------------------------------------- |
| 129 |
|
#-- Update & Run individual test: |
| 130 |
for tt in $tst_list |
for tt in $tst_list |
| 131 |
do |
do |
| 132 |
|
|
| 133 |
|
#- Clean and Update testing clone: --------------------------------------------- |
| 134 |
gcmDIR="MITgcm_$tt" |
gcmDIR="MITgcm_$tt" |
| 135 |
echo "==========================================================================" |
echo "==========================================================================" |
| 136 |
# set -x |
# set -x |
| 137 |
rm -f tr_clean_$tt.log |
rm -f tr_clean_$tt.log |
| 138 |
echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$? |
echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$? |
| 139 |
|
echo $tt | grep '^tap' > /dev/null 2>&1 ; tap=$? |
| 140 |
if test $tt = g7a ; then fwd=0 ; fi |
if test $tt = g7a ; then fwd=0 ; fi |
| 141 |
echo " testing tt= $tt , fwd= $fwd" |
echo " testing tt= $tt , fwd= $fwd , tap= $tap" |
| 142 |
if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then |
if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then |
| 143 |
#- cleaning previous testreport run and updating the code: |
#- cleaning previous testreport run and updating the code: |
| 144 |
if [ $fwd -eq 0 ] ; then |
if [ $fwd -eq 0 -o $tap -eq 0 ] ; then |
| 145 |
|
if test $tt = 'tapTL' ; then clOpt='-tlm' ; else clOpt='-adm' ; fi |
| 146 |
|
if [ $tap -eq 0 ] ; then clOpt="-tap $clOpt" ; fi |
| 147 |
set -x |
set -x |
| 148 |
#- cleanup previous test: |
#- cleanup previous test: |
| 149 |
( cd $gcmDIR/verification ; ./testreport -adm -clean > ../../tr_clean_$tt.log 2>&1 ) |
( cd $gcmDIR/verification ; ./testreport $clOpt -clean > ../../tr_clean_$tt.log 2>&1 ) |
| 150 |
set +x |
set +x |
| 151 |
else |
else |
| 152 |
set -x |
set -x |
| 213 |
pwd |
pwd |
| 214 |
test -e tr_out.txt && mv -f tr_out.txt tr_out.sav |
test -e tr_out.txt && mv -f tr_out.txt tr_out.sav |
| 215 |
|
|
| 216 |
|
#- Run test in corresponding clone: -------------------------------------------- |
| 217 |
case $tt in |
case $tt in |
| 218 |
'iadm' ) |
'iadm' ) |
| 219 |
|
|
| 300 |
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
| 301 |
;; |
;; |
| 302 |
|
|
| 303 |
|
'tapAD') |
| 304 |
|
|
| 305 |
|
./testreport -tap -adm -of ../tools/build_options/linux_amd64_gfortran \ |
| 306 |
|
$sendCmd >> ../../tr_run_$tt.log 2>&1 |
| 307 |
|
|
| 308 |
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
| 309 |
|
;; |
| 310 |
|
|
| 311 |
|
'tapTL') |
| 312 |
|
|
| 313 |
|
./testreport -tap -tlm -of ../tools/build_options/linux_amd64_gfortran \ |
| 314 |
|
$sendCmd >> ../../tr_run_$tt.log 2>&1 |
| 315 |
|
|
| 316 |
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
| 317 |
|
;; |
| 318 |
|
|
| 319 |
'g7a') |
'g7a') |
| 320 |
|
|
| 321 |
./testreport -adm -of ../tools/build_options/linux_amd64_g77 \ |
./testreport -adm -of ../tools/build_options/linux_amd64_g77 \ |
| 418 |
fi |
fi |
| 419 |
|
|
| 420 |
done |
done |
| 421 |
|
|
| 422 |
|
if test $1 = gfort ; then |
| 423 |
|
day=`date +%d` |
| 424 |
|
echo " day in the month='${day}'" |
| 425 |
|
if test $day = 01 -a -f git_Hash ; then |
| 426 |
|
ls -l git_Hash |
| 427 |
|
echo -n ' git_Hash: ' |
| 428 |
|
cat git_Hash |
| 429 |
|
echo "Remove file 'git_Hash' to force tomorrow 'tap' testing" |
| 430 |
|
rm -f git_Hash |
| 431 |
|
fi |
| 432 |
|
fi |