/[MITgcm]/MITgcm_contrib/test_scripts/other/test_local
ViewVC logotype

Diff of /MITgcm_contrib/test_scripts/other/test_local

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11 by jmc, Mon Nov 1 13:45:29 2021 UTC revision 1.18 by jmc, Sat Feb 3 16:43:07 2024 UTC
# Line 3  Line 3 
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
# Line 13  else Line 15  else
15      dd1=`date +%d -d "1 day"`      dd1=`date +%d -d "1 day"`
16  #   if test $dd1 != '01' ; then echo 'not last day of month'; exit ; fi  #   if test $dd1 != '01' ; then echo 'not last day of month'; exit ; fi
17    elif test $1 = gfort ; then    elif test $1 = gfort ; then
18      tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4 g77 g7a'      tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4'
19    #   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'
# Line 23  else Line 28  else
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
# Line 42  ulimit -s unlimited Line 43  ulimit -s unlimited
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    #- expect higher precision if test is run on reference platform+compiler:
50    MC=13
51    
52    echo "-- run: \""`basename $0` $*"\" on:" `date` >> $logFile
53    gcmDIR="MITgcm"
54    if test -e $gcmDIR/.git/config ; then
55      if test ! -f git_Hash ; then
56        echo " Missing file "git_Hash" ==> make one from clone '${gcmDIR}'" >> $logFile
57        ( cd $gcmDIR ; git rev-parse HEAD > ../git_Hash )
58      fi
59    else
60        echo " No current clone ==> get a fresh clone" >> $logFile
61        #rm -f git_Hash prevHash
62        if test -d $gcmDIR ; then /bin/rm -rf $gcmDIR ; fi
63        git clone https://github.com/$git_repo/${git_code}.git $gcmDIR
64        ( cd $gcmDIR ; git rev-parse HEAD > ../git_Hash )
65    fi
66    
67    #-------------------------------------------------------------------------------
68    #-- check particular set of tests:
69    if test $1 = tap ; then
70    #- Only run this pair of test if MITgcm code got updated:
71      if test -f git_Hash -a -f prevHash ; then
72       #ls -l prevHash  >> $logFile
73        diff -q git_Hash prevHash > /dev/null 2>&1
74        retv=$?
75        if test $retv = 0 ; then
76          echo " No update in repos since previous test ==> skip '$1' set of tests"  >> $logFile
77          exit 0
78        else
79          echo " Will run '$1' set of tests since repos has been updated" >> $logFile
80          echo -n ' prevHash: ' >> $logFile
81          cat prevHash >> $logFile
82          echo -n ' git_Hash: ' >> $logFile
83          cat git_Hash >> $logFile
84        fi
85      else
86        echo " No file 'prevHash' --> will run '$1' set of tests" >> $logFile
87      fi
88    elif test $1 = gfort ; then
89      #- to force to skip "tap" test while "gfort" is running:
90      if test -f prevHash ; then
91        cp -p prevHash git_Hash
92      else
93        cp -p git_Hash prevHash
94      fi
95    fi
96    
97    echo "run: \""`basename $0` $*"\" on:" `date`
98    echo " tst_list='$tst_list'"
99    
100    #- to get ~/bin in the patch (for staf) when run on cron:
101    if [ -d ~/bin ]; then
102      echo 'add ~/bin to $PATH'
103      export PATH=$PATH:~/bin
104    #- and for Tapenade:
105      echo $tst_list | grep '\<tap' > /dev/null 2>&1 ; retv=$?
106      if test $retv = 0 ; then
107        source ~jmc/bin/set_tapenade.sh
108      fi
109    fi
110    
111  #-- for now, cannot mix ifort/gfortran tests:  #- for now, cannot mix ifort/gfortran tests:
112  gfort=1  gfort=1
113  for tt in $tst_list  for tt in $tst_list
114  do  do
115    echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$?    echo $tt | grep '^tap' > /dev/null 2>&1 ; retv=$?
116      if [ $retv -ne 0 ] ; then
117        echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$?
118      fi
119    if   [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2    if   [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2
120    elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0    elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0
121    else echo 'cannot mix ifort/gfortran' ; exit    else echo 'cannot mix ifort/gfortran' ; exit
# Line 66  if [ $gfort -eq 2 ] ; then Line 132  if [ $gfort -eq 2 ] ; then
132     source ~jmc/bin/openmpi.sh     source ~jmc/bin/openmpi.sh
133  fi  fi
134    
135  #--------------------------------------------------------------------  #-------------------------------------------------------------------------------
136    #-- Update & Run individual test:
137  for tt in $tst_list  for tt in $tst_list
138  do  do
139    
140    #- Clean and Update testing clone: ---------------------------------------------
141    gcmDIR="MITgcm_$tt"    gcmDIR="MITgcm_$tt"
142    echo "=========================================================================="    echo "=========================================================================="
143  # set -x  # set -x
144    rm -f tr_clean_$tt.log    rm -f tr_clean_$tt.log
145    echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$?    echo $tt | grep '^.ad' > /dev/null 2>&1 ; taf=$?
146    if test $tt = g7a ; then fwd=0 ; fi    echo $tt | grep '^tap' > /dev/null 2>&1 ; tap=$?
147    echo " testing tt= $tt , fwd= $fwd"    if test $tt = g7a ; then taf=0 ; fi
148      echo " testing tt= $tt , taf= $taf , tap= $tap"
149   if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then   if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then
150   #- cleaning previous testreport run and updating the code:   #- cleaning previous testreport run and updating the code:
151    if [ $fwd -eq 0 ] ; then    if [ $taf -eq 0 -o $tap -eq 0 ] ; then
152       if test $tt = 'tapTL' ; then clOpt='-tlm' ; else clOpt='-adm' ; fi
153       if [ $tap -eq 0 ] ; then clOpt="-tap $clOpt" ; fi
154     set -x     set -x
155    #- cleanup previous test:    #- cleanup previous test:
156     ( cd $gcmDIR/verification ; ./testreport -adm -clean > ../../tr_clean_$tt.log 2>&1 )     ( cd $gcmDIR/verification ; ./testreport $clOpt -clean > ../../tr_clean_$tt.log 2>&1 )
157     set +x     set +x
158    else    else
159     set -x     set -x
# Line 149  do Line 220  do
220    pwd    pwd
221    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
222    
223    #- Run test in corresponding clone: --------------------------------------------
224  case $tt in  case $tt in
225  'iadm' )  'iadm' )
226    
# Line 235  case $tt in Line 307  case $tt in
307    sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log    sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
308  ;;  ;;
309    
310    'tapAD')
311    
312      ./testreport -tap -adm -of ../tools/build_options/linux_amd64_gfortran \
313       -match $MC $sendCmd >> ../../tr_run_$tt.log 2>&1
314    
315      sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
316    ;;
317    
318    'tapTL')
319    
320      ./testreport -tap -tlm -of ../tools/build_options/linux_amd64_gfortran \
321       -match $MC $sendCmd >> ../../tr_run_$tt.log 2>&1
322    
323      sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
324    ;;
325    
326  'g7a')  'g7a')
327    
328    ./testreport -adm -of ../tools/build_options/linux_amd64_g77 \    ./testreport -adm -of ../tools/build_options/linux_amd64_g77 \
# Line 337  esac Line 425  esac
425   fi   fi
426    
427  done  done
428    
429    if test $1 = gfort ; then
430      day=`date +%d`
431      echo " day in the month='${day}'"
432      if test $day = 01 -a -f git_Hash ; then
433        ls -l git_Hash
434        echo -n ' git_Hash: '
435        cat git_Hash
436        echo "Remove file 'git_Hash' to force tomorrow 'tap' testing"
437        rm -f git_Hash
438      fi
439    fi

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.22