/[MITgcm]/mitgcm.org/scripts/check_outp
ViewVC logotype

Annotation of /mitgcm.org/scripts/check_outp

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


Revision 1.52 - (hide annotations) (download)
Fri Aug 24 14:18:18 2018 UTC (6 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.51: +2 -2 lines
split engaging tests in 2 groups

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.52 # $Header: /u/gcmpack/mitgcm.org/scripts/check_outp,v 1.51 2018/01/13 16:20:24 jmc Exp $
4 jmc 1.1 #
5     # The purpose of this script is to compare
6     # the latest output with the previous one (from the same platform with
7     # same optfile)
8    
9     usage()
10     {
11     echo
12     echo "Usage: $0 [OPTIONS]"
13 jmc 1.22 echo
14 jmc 1.1 echo "where possible OPTIONS are:"
15     echo " (-h|-help) print usage"
16     echo " (-v|-verbose) verbose mode"
17 jmc 1.36 echo " (-t|-test4update) do nothing if previous output newer than"
18     echo " emails-processing log-file '$PRC_MAILS'"
19 jmc 1.1 echo " (-l |-list )MACHINES check platforms from this list"
20     echo " [def=\"$MACHINES\"]"
21     echo " (-d |-day )FIRSTDAY select output from day=\"YYYYMMDD\""
22 jmc 1.5 echo " (argument of \"date -d\" is allowed)"
23 jmc 1.1 echo " [def=\"$FIRSTDAY\"]"
24     echo " (-u |-upto )LASTDAY until last day=\"YYYYMMDD\" (=selected period)"
25     echo " [def=\"FIRSTDAY\"]"
26 jmc 1.24 echo " (-b |-before)BEFORE compare with output from before \"YYYYMMDD\""
27     echo " (=previous period) [def=\"FIRSTDAY\"]"
28 jmc 1.1 echo " (-o |-outp )OUTPFIL output file (-1 removed when exit)"
29     echo " [def=\"$OUTPFIL\"]"
30     echo " (-n |-nldf )NBLDIFF max number of diff lines to echo"
31     echo " [def=\"$NBLDIFF\"]"
32     echo " (-a |-addr )ADDRESS send summary to mail ADDRESS list"
33     echo " [def=\"$ADDRESS\"]"
34 jmc 1.22 echo
35 jmc 1.1 exit 1
36     }
37    
38 jmc 1.16 # create list of results dir for one platform:
39     make_resdir_list()
40     {
41     if test $monthDir == 1 ; then
42 jmc 1.40 dir_list=`grep '.._'$mname $TMP.dir_all`
43 jmc 1.16 else
44 jmc 1.22 dir_list=`( cd $INDIR ; ls -1 -t ../$PREV_P/??_*${mname}*/summary.txt 2> /dev/null | sed 's/\/summary.txt//' )`
45 jmc 1.16 #echo "dir_list='$dir_list'"
46     fi
47     for i in $dir_list ; do
48    
49     dir=$INDIR"/"$i
50 jmc 1.22 #--- get the opfile used to run testreport
51 jmc 1.16 OPTFILE=
52     if test -r $dir/summary.txt ; then
53     comm=`grep 'OPTFILE=' $dir/summary.txt`
54     eval $comm
55     fi
56     if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then
57     comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
58     eval $comm
59     fi
60     if test "x$OPTFILE" = x ; then
61     comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
62     comm=${comm##*#}
63     eval $comm
64     fi
65     if test "x$OPTFILE" = x ; then
66     OPTFILE="not_explicitly_specified"
67 jmc 1.22 else
68     OPTFILE=${OPTFILE##*/}
69     fi
70     #--- case select test run by 1 user: get user who did run testreport
71     if test "x$sUser" != x ; then
72     tUser=
73     if test -f $dir/genmake_state ; then
74 jmc 1.27 nn=`sed -n '/^# executed by:/=' $dir/genmake_state`
75 jmc 1.22 if test "x$nn" != x ; then
76     nn=`expr $nn + 1`
77     tUser=`sed -n "$nn s/^# *// p" $dir/genmake_state | sed 's/@.*$//'`
78     fi
79     fi
80     if test "x$tUser" = "x" ; then
81     mkfile=`ls $dir/*/Makefile* 2>/dev/null | head -1`
82     if test "x$mkfile" = 'x' ; then
83     echo "no Makefile => discard test from: $i" | tee -a $OUTPFIL
84     continue
85     fi
86     nn=`sed -n '/^# executed by:/=' $mkfile`
87     if test "x$nn" != x ; then
88     nn=`expr $nn + 1`
89     tUser=`sed -n "$nn s/^# *// p" $mkfile | sed 's/@.*$//'`
90     fi
91     fi
92     if test "x$tUser" = x ; then
93     echo "no User found => discard test from: $i" | tee -a $OUTPFIL
94     continue
95     fi
96     if test $tUser != $sUser ; then
97     if test $dBug = 't' ; then
98     echo " discard test from: $i" | tee -a $OUTPFIL
99     fi
100     continue
101     fi
102 jmc 1.16 fi
103    
104 jmc 1.38 ADJOINT=0
105     TANGLIN=0
106     OPENAD=0
107 jmc 1.16 RESTART=0
108 jmc 1.34 EXTRA=
109 jmc 1.28 FAST=0
110     DVLP=0
111 jmc 1.30 MPI=0
112 jmc 1.16 MTH=0
113 jmc 1.30 UR4=0
114 jmc 1.16 if test -r $dir/summary.txt ; then
115 jmc 1.38 ADJOINT=`grep -c -i '^ADJOINT' $dir/summary.txt`
116     if test "x$ADJOINT" = x1 ; then
117     OPENAD=`grep -c '^Adjoint .* OpenAD' $dir/summary.txt`
118     fi
119     TANGLIN=`grep -c -i '^TANGLIN' $dir/summary.txt`
120     if test "x$TANGLIN" = x1 ; then
121     OPENAD=`grep -c '^TangLin .* OpenAD' $dir/summary.txt`
122     fi
123 jmc 1.16 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
124 jmc 1.33 comm=`grep '^run: .*testreport.* ' $dir/summary.txt`
125 jmc 1.34 EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"`
126     if test "x$EXTRA" = x ; then
127     EXTRA=`echo "$comm" | grep " -*-t\>" | sed -e "s/^.*-*-t\>//" -e "s/ -.*$//"`
128     fi
129     if test "x$EXTRA" = x ; then EXTRA=0 ; else
130     #echo -n "EXTRA=$EXTRA"
131     nn0=`echo $EXTRA | sed "s/ *' *//g" | wc -w`
132     nn1=`echo $EXTRA | sed "s/ *' *//g" | tr ' ' '\n' | grep -c "\<monod_"`
133     nn2=`echo $EXTRA | sed "s/ *' *//g" | tr ' ' '\n' | grep -c "\<darwin_"`
134     EXTRA=1
135     if [ $nn1 -ge 2 ] ; then EXTRA=2 ; fi
136     if [ $nn2 -ge 2 ] ; then EXTRA=3 ; fi
137     #echo " : nn0=$nn0 ; nn1=$nn1 ; nn2=$nn2"
138 jmc 1.33 fi
139     FAST=`echo "$comm" | grep -c " -*-fast\>"`
140 jmc 1.28 if test "x$FAST" = x0 ; then
141 jmc 1.33 FAST=`echo "$comm" | grep -c " '*-noieee'*"`
142 jmc 1.28 fi
143 jmc 1.33 DVLP=`echo "$comm" | grep -c " -*-devel\>"`
144     MPI=`echo "$comm" | grep -c " -*-mpi\>"`
145 jmc 1.30 if test "x$MPI" = x0 ; then
146 jmc 1.33 MPI=`echo "$comm" | grep -c " -*-MPI\>"`
147 jmc 1.30 fi
148 jmc 1.33 MTH=`echo "$comm" | grep -c " -*-mth\>"`
149     UR4=`echo "$comm" | grep -c " -*-use_r4\>"`
150 jmc 1.30 if test "x$UR4" = x0 ; then
151 jmc 1.33 UR4=`echo "$comm" | grep -c " -*-ur4\>"`
152 jmc 1.30 fi
153 jmc 1.16 fi
154 jmc 1.38 if test "x$ADJOINT" = x1 ; then
155     kind="adm-TAF" ; order=0
156     if test "x$OPENAD" = x1 ; then kind="adm-OAD" ; order=2 ; fi
157     elif test "x$TANGLIN" = x1 ; then
158     kind="tlm-TAF" ; order=1
159     if test "x$OPENAD" = x1 ; then kind="tlm-OAD" ; order=3 ; fi
160 jmc 1.31 elif test "x$RESTART" = x0 ; then
161 jmc 1.38 kind="forward" ; order=4
162 jmc 1.16 else
163 jmc 1.38 kind="restart" ; order=5
164 jmc 1.33 fi
165 jmc 1.30 if test "x$UR4" = x1 ; then
166     OPTFILE="${OPTFILE}.use_r4"
167     fi
168     if test "x$MPI" = x1 ; then
169     yy=`echo $OPTFILE | grep -c '+mpi'`
170 jmc 1.50 if test $yy = 0 ; then yy=`echo $OPTFILE | grep -c '+impi'` ; fi
171     if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi"
172     else order=`expr $order + 200` ; fi
173 jmc 1.30 fi
174 jmc 1.16 if test "x$MTH" = x1 ; then
175     yy=`echo $OPTFILE | grep -c '+mth$'`
176     if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
177     fi
178 jmc 1.28 if test "x$FAST" = x1 ; then
179     OPTFILE="${OPTFILE}.fast"
180     fi
181     if test "x$DVLP" = x1 ; then
182     OPTFILE="${OPTFILE}.dvlp"
183 jmc 1.16 fi
184 jmc 1.50 order=`expr $order + 10 \* $EXTRA`
185     order=`printf '%3.3i' $order`
186 jmc 1.27 day=`echo $i | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
187     ttt=`echo $day | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
188     day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`
189 jmc 1.16
190 jmc 1.32 if [ $day -lt $BEFORE ] ; then
191 jmc 1.40 echo "$OPTFILE$order $day $OPTFILE $kind $i" >> $TMP.plist
192 jmc 1.27 elif [ $day -ge $FIRSTDAY -a $day -le $LASTDAY ] ; then
193 jmc 1.40 echo "$OPTFILE$order $day $OPTFILE $kind $i" >> $TMP.slist
194 jmc 1.16 else
195     if test $dBug = 't' ; then
196     echo "discard day='$day' from: $i" | tee -a $OUTPFIL
197     fi
198     fi
199    
200     done
201     if test $dBug = 't' ; then
202     if test $monthDir == 1 ; then
203     echo "---- current list (n=$monthDir) :" | tee -a $OUTPFIL
204 jmc 1.40 cat $TMP.slist | tee -a $OUTPFIL
205 jmc 1.16 fi
206 jmc 1.40 num1=`wc -l $TMP.slist | awk '{print $1}'`
207 jmc 1.16 if test $num1 -gt 0 ; then
208     echo ".... previous list (n=$monthDir):" | tee -a $OUTPFIL
209 jmc 1.40 cat $TMP.plist | tee -a $OUTPFIL | head -20
210 jmc 1.16 fi
211     echo "----" | tee -a $OUTPFIL
212     fi
213     }
214    
215     #--------------------------------------------------------------------------
216     # here starts the sequential part of the script:
217    
218 jmc 1.1 #CURR_PER=`date +%Y`"_"`date +%m`
219     CURR_DAY=`date +%Y%m%d`
220 jmc 1.36 PRC_MAILS='prc_emails_'`date +%m%d`
221 jmc 1.1 # defaults
222     MACHINES='_All_'
223     FIRSTDAY=$CURR_DAY
224     LASTDAY="30000000"
225 jmc 1.24 BEFORE="30000000"
226 jmc 1.1 OUTPFIL=`basename $0`'.log'
227     NBLDIFF=5
228     ADDRESS='none'
229 jmc 1.46 MAILCMD="mail"
230 jmc 1.1 dBug=f
231 jmc 1.36 t4update=0
232 jmc 1.1 sTime=`date`
233 jmc 1.12 #- to get case insensitive "ls" (and order of tested experiments)
234     export LC_ALL="en_US.UTF-8"
235 jmc 1.1
236     # Parse options
237     ac_prev=
238     for ac_option ; do
239    
240     # If the previous option needs an argument, assign it.
241     if test -n "$ac_prev"; then
242 jmc 1.32 eval "$ac_prev=\$ac_option"
243     ac_prev=
244     continue
245 jmc 1.1 fi
246    
247     ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
248     case $ac_option in
249    
250 jmc 1.27 -help | --help | -h | --h) usage ;;
251     -verbose | --verbose | -v | --v) dBug=t ;;
252 jmc 1.36 -test4update | --test4update | -t | --t) t4update=1 ;;
253 jmc 1.1
254 jmc 1.27 -list | --list | -l | --l) ac_prev=MACHINES ;;
255     -list=* | --list=*) MACHINES=$ac_optarg ;;
256    
257     -day | --day | -d | --d) ac_prev=FIRSTDAY ;;
258     -day=* | --day=*) FIRSTDAY=$ac_optarg ;;
259    
260     -upto | --upto | -u | --u) ac_prev=LASTDAY ;;
261     -upto=* | --upto=*) LASTDAY=$ac_optarg ;;
262    
263     -before | --before | -b | --b) ac_prev=BEFORE ;;
264     -before=* | --before=*) BEFORE=$ac_optarg ;;
265    
266     -outp | --outp | -o | --o) ac_prev=OUTPFIL ;;
267     -outp=* | --outp=*) OUTPFIL=$ac_optarg ;;
268    
269     -nldf | --nldf | -n | --n) ac_prev=NBLDIFF ;;
270     -nldf=* | --nldf=*) NBLDIFF=$ac_optarg ;;
271    
272     -addr | --addr | -a | --a) ac_prev=ADDRESS ;;
273     -addr=* | --addr=*) ADDRESS=$ac_optarg ;;
274    
275     *) echo "Error: don't understand argument \"$ac_option\""
276     usage ;;
277 jmc 1.1 esac
278    
279     done
280 jmc 1.40
281     #TMP=./chkoutp_$$
282     #- try to put temporary files in system-local /tmp dir
283     TMP=/tmp/chkoutp_$$
284     touch $TMP ; retVal=$?
285     if [ $retVal -eq 0 ] ; then
286     if test ! -r $TMP ; then TMP=./chkoutp_$$ ; fi
287     else
288     TMP=./chkoutp_$$
289     fi
290     rm -f $TMP
291     if test $dBug = 't' ; then echo "temp files: $TMP" ; fi
292    
293 jmc 1.5 #-- test FIRSTDAY content ; interpret as "date -d" arg. if not YYYYMMDD
294     ttt=`echo "y$FIRSTDAY" | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/z/'`
295     if test "x$ttt" != 'xyz' ; then
296     FIRSTDAY=`date -d "$FIRSTDAY" +%Y%m%d`
297     fi
298     ttt=`echo "y$FIRSTDAY" | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/z/'`
299     if test "x$ttt" != 'xyz' ; then
300     echo "Error: FIRSTDAY='$FIRSDAY' not recognized"
301     exit 2
302     fi
303 jmc 1.1 if test $LASTDAY = "30000000" ; then LASTDAY=$FIRSTDAY ; fi
304 jmc 1.24 if test $BEFORE = "30000000" ; then BEFORE=$FIRSTDAY ; fi
305 jmc 1.1 CMDLINE=$0
306     for xx in "$@" ; do nw=`echo $xx | wc -w`
307     if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
308     else CMDLINE="$CMDLINE '$xx'" ; fi
309     done
310    
311 jmc 1.24 PERIOD=`echo $LASTDAY | sed 's/[0-9][0-9]$//'`
312 jmc 1.1 PP=`expr $PERIOD - 1`
313     PM=`echo $PP | sed 's/^[0-9][0-9][0-9][0-9]//'`
314     PY=`echo $PP | sed 's/[0-9][0-9]$//'`
315     if test $PM == '00' ; then PM='12' ; PY=`expr $PY - 1` ; fi
316     PREV_P="${PY}_${PM}";
317     PERIOD=`echo $PERIOD | sed 's/^[0-9][0-9][0-9][0-9]/&_/'`
318    
319 jmc 1.51 #INDIR="/net/zany.mit.edu/data/ORWELL/export-9/mitgcm-testing/results/$PERIOD"
320 jmc 1.1 INDIR="/u/u0/httpd/html/testing/results/$PERIOD"
321 jmc 1.51 #INDIR="$HOME/mitgcm/test_web/results/$PERIOD"
322 jmc 1.1
323 jmc 1.36 #- a short summary of this checking :
324     OUTPSUM=`echo $LASTDAY | sed 's/^20../_/'`
325     OUTPSUM=`basename $0`"$OUTPSUM.txt"
326    
327 jmc 1.1 if test $OUTPFIL = '-1' ; then
328     OUTPFIL='TTT.'$$
329 jmc 1.36 fi
330     if test $t4update = 1 ; then
331     if test -f $PRC_MAILS -a -f $OUTPSUM -a $FIRSTDAY = $CURR_DAY ; then
332     #- if update-log-file is older than previous output summary, just return
333     if test $PRC_MAILS -ot $OUTPSUM ; then
334 jmc 1.37 echo ' '$CMDLINE | tee -a $OUTPSUM
335     echo " t4update: skip "`basename $0`" ( $PRC_MAILS older than $OUTPSUM )" | tee -a $OUTPSUM
336 jmc 1.40 echo " End time: "`date` | tee -a $OUTPSUM
337 jmc 1.36 exit 0
338     else
339     if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi
340     echo " t4update: run "`basename $0`" ( $PRC_MAILS newer than $OUTPSUM )" | tee $OUTPFIL
341     fi
342 jmc 1.49 elif test -f $OUTPSUM -a $FIRSTDAY = $CURR_DAY ; then
343     echo ' '$CMDLINE | tee -a $OUTPSUM
344     echo " t4update: skip "`basename $0`" ( $PRC_MAILS missing )" | tee -a $OUTPSUM
345     echo " End time: "`date` | tee -a $OUTPSUM
346     exit 0
347 jmc 1.36 else
348     if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi
349 jmc 1.49 echo " t4update ignored (not current day or $OUTPSUM missing)" | tee $OUTPFIL
350 jmc 1.36 fi
351 jmc 1.1 elif test -e $OUTPFIL ; then
352     mv -f $OUTPFIL $OUTPFIL'_bak'
353 jmc 1.36 touch $OUTPFIL
354 jmc 1.1 fi
355 jmc 1.37 if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi
356     echo ' '$CMDLINE > $OUTPSUM
357 jmc 1.36
358     echo "CMDLINE='$CMDLINE'" >> $OUTPFIL
359 jmc 1.1 echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL
360     echo "INDIR='$INDIR'" >> $OUTPFIL
361     echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL
362 jmc 1.24 echo " versus latest from before $BEFORE" >> $OUTPFIL
363 jmc 1.1
364 jmc 1.22 if test $dBug = 't' ; then
365 jmc 1.1 echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'"
366 jmc 1.24 echo "FIRSTDAY='$FIRSTDAY' , LASTDAY='$LASTDAY' , BEFORE='$BEFORE'"
367 jmc 1.1 fi
368     if test -d $INDIR ; then
369     dirP=`echo $INDIR | sed "s/$PERIOD/$PREV_P/"`
370     if test -d $dirP ; then
371     listNum='1 2'
372     else
373     echo "$dirP is not a directory"
374     listNum='1'
375     fi
376     else
377     echo "$INDIR is not a directory"
378 jmc 1.5 exit 3
379 jmc 1.1 fi
380    
381     if test $FIRSTDAY = $LASTDAY ; then
382     echo -n "Checking latest output from $FIRSTDAY" | tee -a $OUTPSUM
383     else
384     echo -n "Checking latest output from $FIRSTDAY until $LASTDAY" | tee -a $OUTPSUM
385     fi
386 jmc 1.24 if test $FIRSTDAY = $BEFORE ; then
387     echo " versus latest prior to this period" | tee -a $OUTPSUM
388     else
389     echo " versus latest from before $BEFORE" | tee -a $OUTPSUM
390     fi
391 jmc 1.1 echo " Machine Tot. Nb. no Nb with Nb diff" >> $OUTPSUM
392     echo " name checked comp Diff lines" >> $OUTPSUM
393    
394 jmc 1.40 ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > $TMP.dir_all
395 jmc 1.1
396     if test "x$MACHINES" = "x_All_" ; then
397 jmc 1.52 MACHINES="aces- acesgrid baudelaire engaging1 engaging- svante glacier ollie stan1"
398 jmc 1.47 MACHINES="$MACHINES pleiades archer stomp octopus saramago"
399 jmc 1.1
400 jmc 1.40 MALL=`cat $TMP.dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
401 jmc 1.1 for madd in $MALL ; do
402     present=0
403     for m in $MACHINES ; do
404 jmc 1.27 mm=`echo $m | sed 's/\./ /g' | awk '{print $1}'`
405     echo $madd | grep $mm > /dev/null 2>&1
406     RETVAL=$?
407     test $RETVAL = 0 && present=1
408     continue
409 jmc 1.1 done
410     test $present = 0 && MACHINES="$MACHINES $madd"
411     done
412     fi
413 jmc 1.22 #echo "MACHINES=$MACHINES" ; exit
414 jmc 1.1
415 jmc 1.22 for pname in $MACHINES ; do
416 jmc 1.1
417 jmc 1.29 sname=`echo $pname | sed 's/-$//'`
418 jmc 1.22 mname=`echo $pname | sed 's/\./ /g' | awk '{print $1}'`
419     sUser=
420     if test $mname != $pname ; then
421     # to select results from user "sUser"
422     sUser=`echo $pname | sed 's/\./ /g' | awk '{print $2}'`
423     fi
424    
425     if test $dBug = 't' ; then echo " $pname" ; fi
426     echo " name='$pname'" >> $OUTPFIL
427 jmc 1.1 ctot=0 ; cmis=0 ; cdif=0
428    
429 jmc 1.40 # put results from selected period in "TMP.slist",
430     # results from previous period in "TMP.plist"
431     rm -f $TMP.plist $TMP.slist ; touch $TMP.plist $TMP.slist
432 jmc 1.1
433 jmc 1.16 #- create list of results (slist & plist) from current month directory
434     monthDir=1
435     make_resdir_list
436 jmc 1.1
437     # Do we have any data? If so, create the latest pointer.
438 jmc 1.40 num=`wc -l $TMP.slist | awk '{print $1}'`
439 jmc 1.1 if test $num -gt 0 ; then
440    
441 jmc 1.40 keys=`cat $TMP.slist | cut -d " " -f 1 | sort | uniq`
442 jmc 1.1
443     for key in $keys ; do
444 jmc 1.39 ctot=`expr $ctot + 1`
445 jmc 1.40 sline=`grep "^$key " $TMP.slist | head -1`
446 jmc 1.27 sdir=`echo $sline | cut -d " " -f 5`
447     type=`echo $sline | cut -d " " -f 4`
448     optf=`echo $sline | cut -d " " -f 3`
449 jmc 1.40 num=`grep -c "^$key" $TMP.plist`
450 jmc 1.27 if test $num = 0 -a $monthDir = 1 ; then
451     #- add results from previous month directory to "plist".
452     monthDir=2
453     make_resdir_list
454 jmc 1.40 num=`grep -c "^$key" $TMP.plist`
455 jmc 1.27 fi
456 jmc 1.1 #- discard unsafe test:
457 jmc 1.18 dd=`echo $optf | grep -c 'gfortran+mth'`
458 jmc 1.22 if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi
459     if test $mname = 'harbor' -a $dd = 1 ; then num=-1 ; fi
460 jmc 1.13 #if test $mname = 'aces' -a $optf = 'linux_ia32_open64' ; then num=-1 ; fi
461     #if test $mname = 'aces' -a $optf = 'linux_ia32_g95' ; then num=-1 ; fi
462 jmc 1.23 dd=`echo $optf | grep -c 'bigred.*noieee'`
463 jmc 1.29 #if test $mname = 'bigred' -a $dd = 1 ; then num=-1 ; fi
464 jmc 1.18 if test $num -lt 0 ; then
465     echo " discard $sdir : $type , of='$optf'" | tee -a $OUTPFIL
466 jmc 1.27 cmis=`expr $cmis + 1`
467     elif test $num = '0' ; then
468 jmc 1.44 echo " dir='$sdir', type='$type', of='$optf':" | tee -a $OUTPFIL
469     echo " --> no previous test matching key='$key'" | tee -a $OUTPFIL
470 jmc 1.27 cmis=`expr $cmis + 1`
471 jmc 1.18 else
472 jmc 1.40 pline=`grep "^$key " $TMP.plist | head -1`
473 jmc 1.22 if test $dBug = 't' ; then
474 jmc 1.1 echo "s='$sline'" | tee -a $OUTPFIL
475     echo "p='$pline'" | tee -a $OUTPFIL
476     fi
477 jmc 1.27 pdir=`echo $pline | cut -d " " -f 5`
478 jmc 1.1 outs="$INDIR/$sdir/summary.txt"
479 jmc 1.27 xx=`( echo 5 ; sed -n '/^ OPTFILE=/=' $outs ) | tail -1`
480     sed "1,$xx d" $outs | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \
481 jmc 1.40 | grep -v '^[A-S][a-t]* time: ' > $TMP.fs
482 jmc 1.1 outp="$INDIR/$pdir/summary.txt"
483 jmc 1.27 xx=`( echo 5 ; sed -n '/^ OPTFILE=/=' $outp ) | tail -1`
484     sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \
485 jmc 1.40 | grep -v '^[A-S][a-t]* time: ' > $TMP.fp
486 jmc 1.39 #-- check if list of exp are the same (and in the same order)
487 jmc 1.40 sed 's/ (e=.*, w=.*)$//' $TMP.fs > $TMP.fn
488     listDs=`grep '^[YN] [YN] [YN] [YN]' $TMP.fn | awk '{print $NF}'`
489     #mv -f $TMP.fn $TMP.fs
490     rm -f $TMP.fn
491     sed 's/ (e=.*, w=.*)$//' $TMP.fp > $TMP.fn
492     listDp=`grep '^[YN] [YN] [YN] [YN]' $TMP.fn | awk '{print $NF}'`
493     #mv -f $TMP.fn $TMP.fp
494     rm -f $TMP.fn
495 jmc 1.39 #echo "listDs='$listDs'" ; echo "listDp='$listDp'"
496     if test "$listDs" != "$listDp" ; then
497     if test $dBug = 't' ; then echo ' -> re-order list of exp' ; fi
498     #-- re-order list of exp (according to local "sort" order)
499     listDs=`echo "$listDs" | sort`
500     for xx in $listDs ; do
501 jmc 1.40 sed -e "/ $xx\$/d" -e "/ $xx /d" $TMP.fs > $TMP.fn
502     sed -n -e "/ $xx\$/p" -e "/ $xx /p" $TMP.fs >> $TMP.fn
503     mv -f $TMP.fn $TMP.fs
504 jmc 1.39 done
505     listDp=`echo "$listDp" | sort`
506     for xx in $listDp ; do
507 jmc 1.40 sed -e "/ $xx\$/d" -e "/ $xx /d" $TMP.fp > $TMP.fn
508     sed -n -e "/ $xx\$/p" -e "/ $xx /p" $TMP.fp >> $TMP.fn
509     mv -f $TMP.fn $TMP.fp
510 jmc 1.39 done
511     #else
512     # echo 'same list of exp => skip re-ordering'
513     fi
514 jmc 1.1 echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL
515 jmc 1.40 diff $TMP.fs $TMP.fp > $TMP.dif
516 jmc 1.1 yy=$?
517     if test $yy != '0' ; then
518 jmc 1.27 echo " $type , of='$optf'" | tee -a $OUTPFIL
519 jmc 1.1 #grep '^run: ' $outp
520     #grep '^run: ' $outs
521     #-- score for each test:
522 jmc 1.40 grep '^[YN] [YN] [YN] [YN]' $TMP.fs > tmploc 2>/dev/null
523 jmc 1.1 t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`
524     t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`
525     score_s=`printf '%2i' $t_pass`":$t_tot"
526 jmc 1.40 grep '^[YN] [YN] [YN] [YN]' $TMP.fp > tmploc 2>/dev/null
527 jmc 1.1 t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`
528     t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`
529     score_p=`printf '%2i' $t_pass`":$t_tot"
530     rm -f tmploc
531     #-- count Nb of different lines
532 jmc 1.40 ndf=`wc -l $TMP.dif | awk '{print $1}'`
533 jmc 1.1 ndf=`expr $ndf / 2`
534 jmc 1.40 nn=`grep -c '^---' $TMP.dif`
535 jmc 1.1 ndf=`expr $ndf - $nn`
536 jmc 1.27 if [ $ndf -le $NBLDIFF ] ; then
537 jmc 1.40 cat $TMP.dif
538 jmc 1.1 else
539     echo " $ndf lines differ ( $score_s , $score_p )"
540     fi
541     echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL
542     echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL
543 jmc 1.40 cat $TMP.dif >> $OUTPFIL
544 jmc 1.27 if [ $cdif -eq 0 ] ; then
545 jmc 1.1 clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
546 jmc 1.22 else
547 jmc 1.1 clin="$clin,"`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
548     fi
549 jmc 1.27 cdif=`expr $cdif + 1`
550 jmc 1.1 echo '----------------------------------------' | tee -a $OUTPFIL
551     else
552 jmc 1.18 echo " $type , of='$optf'" | tee -a $OUTPFIL
553 jmc 1.1 fi
554 jmc 1.40 rm -f $TMP.fs $TMP.fp $TMP.dif
555 jmc 1.27 fi
556 jmc 1.1 done
557 jmc 1.27 if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi
558 jmc 1.29 printf '%11s : %3i %4s %3i ' $sname $ctot $tmis $cdif >> $OUTPSUM
559 jmc 1.27 if [ $cdif -gt 0 ] ; then
560     echo " $clin" >> $OUTPSUM
561     else echo "" >> $OUTPSUM ; fi
562 jmc 1.1 fi
563    
564     done
565    
566     echo "Start time: $sTime" | tee -a $OUTPFIL
567 jmc 1.40 echo "End time: "`date` | tee -a $OUTPFIL | tee -a $OUTPSUM
568 jmc 1.1
569 jmc 1.40 rm -f $TMP.dir_all $TMP.slist $TMP.plist
570 jmc 1.1 if test $OUTPFIL = "TTT.$$" ; then rm -f $OUTPFIL ; fi
571     if test "x$ADDRESS" != 'xnone' ; then
572 jmc 1.46 #- change default sender address ("From:") using "mail -r" option
573     # since, by default, baudelaire uses USER@localhost.localdomain
574 jmc 1.48 #fullNam=`hostname -A | awk '{print $1}'`
575     #MAILCMD="$MAILCMD -r ${USER}@${fullNam}"
576 jmc 1.46 #---
577     echo ".. send $OUTPSUM to '$ADDRESS' using '$MAILCMD'"
578     $MAILCMD -s 'check_outp summary' $ADDRESS < $OUTPSUM
579 jmc 1.1 fi
580     echo ".. cat $OUTPSUM"
581     cat $OUTPSUM
582 jmc 1.5 exit 0

  ViewVC Help
Powered by ViewVC 1.1.22