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

Contents of /mitgcm.org/scripts/check_outp

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


Revision 1.54 - (show annotations) (download)
Tue Jan 5 22:49:57 2021 UTC (3 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.53: +28 -13 lines
adjustied to recognize darwin3 test

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

  ViewVC Help
Powered by ViewVC 1.1.22