91 |
{ |
{ |
92 |
# testoutput_for_prop dir s1 label subdir extension |
# testoutput_for_prop dir s1 label subdir extension |
93 |
# |
# |
94 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
# compares files $dir/$subdir/$OUTPUTFILE and $dir/results/output.txt |
95 |
# using search strings s1 and text label |
# using search strings s1 and text label |
96 |
|
|
97 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
98 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
99 |
fi |
fi |
100 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
101 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | cat -n > tmp1.txt |
102 |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
103 |
if [ $lncntA -lt 3 ]; then |
if [ $lncntA -lt 3 ]; then |
104 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
107 |
return 99 |
return 99 |
108 |
fi |
fi |
109 |
else |
else |
110 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE from model run was not readable 1>&2 |
111 |
return 99 |
return 99 |
112 |
fi |
fi |
113 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
129 |
fi |
fi |
130 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
131 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
132 |
echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
133 |
return 99 |
return 99 |
134 |
fi |
fi |
135 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
136 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
137 |
echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 |
echo testoutput_for_prop: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
138 |
return 99 |
return 99 |
139 |
fi |
fi |
140 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
184 |
testoutput_ad() |
testoutput_ad() |
185 |
{ |
{ |
186 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
187 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $5}' > t15.txt |
188 |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
189 |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt |
grep $3 $1/$2/$OUTPUTFILE | awk '{print NR " " $6}' > t16.txt |
190 |
join t05.txt t15.txt > t5.txt |
join t05.txt t15.txt > t5.txt |
191 |
join t06.txt t16.txt > t6.txt |
join t06.txt t16.txt > t6.txt |
192 |
echo "-1" >> t5.txt |
echo "-1" >> t5.txt |
341 |
else |
else |
342 |
( |
( |
343 |
cd $1; |
cd $1; |
344 |
#if test -e output.txt ; then rm -f output.txt ; fi |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
345 |
if test -r Makefile ; then |
if test -r Makefile ; then |
346 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
printf 'clean build-dir: make Clean ... ' 2>&1 |
347 |
$MAKE Clean >> make.log 2>&1 |
$MAKE Clean >> make.log 2>&1 |
536 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
537 |
# make output.txt |
# make output.txt |
538 |
echo |
echo |
|
rm -f run.log |
|
539 |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
540 |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log |
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_00 |
541 |
ln -sf "../"$builddir"/"$EXECUTABLE . |
ln -sf "../"$builddir"/"$EXECUTABLE . |
|
else |
|
|
touch run.log |
|
542 |
fi |
fi |
543 |
if test ! -x $EXECUTABLE ; then |
if test ! -x $EXECUTABLE ; then |
544 |
|
rm -f run.log ; touch run.log |
545 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
546 |
echo " no executable:" $EXECUTABLE >> run.log |
echo " no executable:" $EXECUTABLE >> run.log |
547 |
RETVAL=8 |
RETVAL=8 |
548 |
|
ENDVAL=-1 |
549 |
else |
else |
550 |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
551 |
|
rm -f run.log ; touch run.log |
552 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
553 |
( eval $COMMAND ) >> run.log 2>&1 |
( eval $COMMAND ) >> run.log 2>&1 |
554 |
RETVAL=$? |
RETVAL=$? |
555 |
else |
else |
|
echo " $OUTPUTFILE is up to date " >> run.log 2>&1 |
|
556 |
RETVAL=0 |
RETVAL=0 |
557 |
|
if test -f run.log ; then |
558 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
559 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
560 |
|
else |
561 |
|
touch run.log |
562 |
|
if test -f run.log_00 ; then cat run.log_00 >> run.log ; fi |
563 |
|
echo "---------->> $OUTPUTFILE is up to date " >> run.log 2>&1 |
564 |
|
echo " no previous run.log: assume NORMAL END" >> run.log 2>&1 |
565 |
|
fi |
566 |
fi |
fi |
567 |
|
ENDVAL=`cat run.log | grep -v 'ABNORMAL END' | grep -c 'NORMAL END'` |
568 |
fi |
fi |
569 |
# echo "COMMAND='$COMMAND'" |
rm -f run.log_00 |
570 |
# echo "pwd='"`pwd`"'" |
#if test "x$RETVAL" = x0 ; then |
571 |
if test "x$RETVAL" = x0 ; then |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
572 |
tail run.log |
tail run.log |
573 |
echo successful 1>&2 |
echo successful 1>&2 |
574 |
# === Reduce the size of the testing emails! |
# === Reduce the size of the testing emails! |
575 |
# if test "x$ADM" = x ; then |
#cp $OUTPUTFILE $CDIR"/"$OUTPUTFILE |
|
# cp output.txt $CDIR"/output.txt" |
|
|
# else |
|
|
# cp output_adm.txt $CDIR"/output_adm.txt" |
|
|
# fi |
|
576 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
577 |
return 0 |
return 0 |
578 |
else |
else |
579 |
tail run.log |
tail run.log |
580 |
echo failed 1>&2 |
echo failed '(run:' $RETVAL ' end:' $ENDVAL ')' 1>&2 |
581 |
cp run.log $CDIR"/run.log" |
cp run.log $CDIR"/run.log" |
582 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
583 |
return 1 |
return 1 |
890 |
OUTPUTFILE="output.txt" |
OUTPUTFILE="output.txt" |
891 |
fi |
fi |
892 |
|
|
|
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
|
|
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
|
|
fi |
|
|
|
|
893 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
894 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
895 |
fi |
fi |
896 |
|
if test "x$MPI" = xt ; then |
897 |
|
OUTPUTFILE="STDOUT.0000" |
898 |
|
fi |
899 |
|
|
900 |
#echo "OK" |
#echo "OK" |
901 |
echo "OK (COMMAND= $COMMAND )" |
echo "OK (COMMAND= $COMMAND )" |