Changeset 5682 for branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/TOOLS/MISCELLANEOUS/chk_wrk_alloc.sh
- Timestamp:
- 2015-08-12T17:46:45+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2015/dev_r5072_UKMO2_OBS_simplification/NEMOGCM/TOOLS/MISCELLANEOUS/chk_wrk_alloc.sh
r3294 r5682 12 12 # ../TOOLS/MISCELLANEOUS/chk_wrk_alloc.sh 13 13 # 14 set -u e14 set -u 15 15 # 16 16 echo "check for all *90 files contained in "$( pwd )" and its subdirectories" 17 17 # 18 for ff in $( grep -il wrk_nemo_2 $( find . -name "*90" ) )18 for ff in $( grep -il "^ *use *wrk_nemo" $( find . -name "*90" ) $( find . -name "*h90" ) ) 19 19 do 20 ierr=0 21 22 # number of lines with wrk_alloc 23 n1=$( grep -ic "call *wrk_alloc *(" $ff ) 24 # number of lines with wrk_dealloc 25 nn1=$( grep -ic "call *wrk_dealloc *(" $ff ) 26 27 if [ $(( $n1 + $nn1 )) -ne 0 ] 28 then 29 # replace wrk_alloc with wrk_dealloc and count the lines 30 n2=$( sed -e "s/wrk_alloc/wrk_dealloc/" $ff | grep -ic "call *wrk_dealloc *(" ) 31 # we should get n2 = 2 * n1... 32 if [ $(( 2 * $n1 )) -ne $n2 ] 33 then 34 ierr=1 35 echo "problem with wrk_alloc in $ff" 36 fi 37 # same story but for wrk_dealloc 38 nn2=$( sed -e "s/wrk_dealloc/wrk_alloc/" $ff | grep -ic "call *wrk_alloc *(" ) 39 if [ $(( 2 * $nn1 )) -ne $nn2 ] 40 then 41 ierr=1 42 echo "problem with wrk_dealloc in $ff" 43 fi 20 44 21 # number of lines with wrk_alloc 22 n1=$( grep -ic "call *wrk_alloc *(" $ff ) 23 # replace wrk_alloc with wrk_dealloc and count the lines 24 n2=$( sed -e "s/wrk_alloc/wrk_dealloc/" $ff | grep -ic "call *wrk_dealloc *(" ) 25 # we should get n2 = 2 * n1... 26 [ $(( 2 * $n1 )) -ne $n2 ] && echo "problem with wrk_alloc in $ff" 27 28 # same story but for wrk_dealloc 29 n1=$( grep -ic "call *wrk_dealloc *(" $ff ) 30 n2=$( sed -e "s/wrk_dealloc/wrk_alloc/" $ff | grep -ic "call *wrk_alloc *(" ) 31 [ $(( 2 * $n1 )) -ne $n2 ] && echo "problem with wrk_dealloc in $ff" 32 45 if [ $ierr -eq 0 ] # check that wrk_alloc block is the same as wrk_dealloc block 46 then 47 grep -i "call *wrk_alloc *(" $ff | sed -e "s/ //g" | sed -e "s/!.*//g" > txt1$$ 48 grep -i "call *wrk_dealloc *(" $ff | sed -e "s/wrk_dealloc/wrk_alloc/" | sed -e "s/ //g" | sed -e "s/!.*//g" > txt2$$ 49 cmp txt1$$ txt2$$ 50 if [ $? -ne 0 ] 51 then 52 echo "different syntax in wrk_alloc and wrk_dealloc in $ff" 53 echo 54 for ll in $( seq 1 $n1 ) # compare each line 55 do 56 sed -n ${ll}p txt1$$ > ll1$$ 57 sed -n ${ll}p txt2$$ > ll2$$ 58 cmp ll1$$ ll2$$ > /dev/null 59 if [ $? -ne 0 ] 60 then 61 grep -i "call *wrk_alloc *(" $ff | sed -n ${ll}p 62 grep -i "call *wrk_dealloc *(" $ff | sed -n ${ll}p 63 echo 64 fi 65 rm -f ll1$$ ll2$$ 66 done 67 fi 68 rm -f txt1$$ txt2$$ 69 else 70 grep -i "call *wrk_alloc *(" $ff 71 echo 72 grep -i "call *wrk_dealloc *(" $ff 73 echo 74 fi 75 76 fi 77 33 78 done
Note: See TracChangeset
for help on using the changeset viewer.