[BACK]Return to dotest CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / pari-2.2 / src / test

Annotation of OpenXM_contrib/pari-2.2/src/test/dotest, Revision 1.1

1.1     ! noro        1: #!/bin/sh
        !             2:
        !             3: wrln () { echo "$1"; echo "$1" >> $file_bench; }
        !             4:
        !             5: wr () { echo $n "$1$c"; echo $n "$1$c" >> $file_bench; }
        !             6:
        !             7: confdir=../config
        !             8: testdir=../src/test
        !             9: execdir=.
        !            10: #Format: filename_weight (weight = 1000 if omitted)
        !            11: #  individual times are not modified whereas accumulated time is weighed
        !            12: #  by (weight / 1000)
        !            13: test -z "$testlist" && testlist="\
        !            14:   objets\
        !            15:   analyz\
        !            16:   number\
        !            17:   polyser\
        !            18:   linear\
        !            19:   elliptic\
        !            20:   sumiter\
        !            21:   graph\
        !            22:   program\
        !            23:   trans\
        !            24:   nfields_200\
        !            25: "
        !            26: if test -f /bin/rm ; then RM=/bin/rm; else RM=rm ; fi
        !            27: if sh -c 'test -x /bin/sh' 2>&-; then x=-x; else x=-r; fi
        !            28: (echo "hi there\c" ; echo " ") > echotmp
        !            29: if grep c echotmp >/dev/null 2>&1 ; then n=-n; c=; else n=; c='\c'; fi
        !            30: $RM echotmp
        !            31:
        !            32: case "$1" in
        !            33:   8) bitlen=64 ;;
        !            34:   *) bitlen=32 ;;
        !            35: esac
        !            36: case "$2" in
        !            37:   -c) testlist=compat;;
        !            38:   -g) testlist=ploth;;
        !            39:   -a) testlist=all;;
        !            40: esac
        !            41:
        !            42: . $confdir/version
        !            43: file_bench=Bench-$VersionMajor.$VersionMinor.$patch
        !            44: if (touch $file_bench 2> /dev/null); then
        !            45:   SUF=
        !            46: else
        !            47:   if test ! $x $execdir/gp.exe; then
        !            48:     echo "build gp.exe first" >&2; exit 1
        !            49:   fi
        !            50:   if (echo | gp -test -q 2> /dev/null); then
        !            51:     gp=gp
        !            52:   else
        !            53:     gp="command /c gp"
        !            54:   fi
        !            55:   if (expr 2 \* 2 2> /dev/null); then exprbug=0; else exprbug=1; fi
        !            56:   SUF="exe"; file_bench=Bench.$patch
        !            57: fi
        !            58: $RM -f $file_bench
        !            59:
        !            60: dotestSUF=${dotestSUF:-"sta dyn"}
        !            61: for arg in $dotestSUF; do
        !            62:   case "$arg" in
        !            63:     sta|dyn) if test $x $execdir/gp-$arg; then SUF="$SUF $arg"; fi ;;
        !            64:   esac
        !            65: done
        !            66: file_test=gp.out
        !            67: for suf in $SUF; do eval time$suf=0 files$suf=; done
        !            68: for testdata in $testlist; do
        !            69:   O=$IFS;IFS=_;set $testdata;IFS=$O;testname=$1;testmul=$2
        !            70:   file_in=$testdir/in/$testname
        !            71:   file_out=$testdir/$bitlen/$testname
        !            72:   if test ! -r $file_in -o ! -r $file_out; then
        !            73:     wrln "Error! Missing file, can't test $testname"
        !            74:   else
        !            75:     testmul=${testmul:-1000}
        !            76:     wr "* Testing $testname $c"
        !            77:     for suf in $SUF; do
        !            78:       wr "     for gp-$suf..$c"
        !            79:       case "$suf" in
        !            80:         exe) file_diff=$testname.dif;;
        !            81:        *)   file_diff=$testname-$suf.dif
        !            82:             gp=$execdir/gp-$suf;;
        !            83:       esac
        !            84:       $gp -q -test < $file_in > $file_test 2>&1
        !            85:       diff -c $file_out $file_test > $file_diff
        !            86:       pat=`grep "^[-+!] " $file_diff | grep -v "Total time"`
        !            87:       time=`tail -2 $file_test | sed -n 's,.*Total time spent: \(.*\),\1,p'`
        !            88:       if test -n "$time"; then
        !            89:         eval t='$'time$suf
        !            90:        if test -n "$exprbug"; then
        !            91:          t=`expr $time \'\*\' $testmul / 1000 + $t`
        !            92:        else
        !            93:          t=`expr $time '*' $testmul / 1000 + $t`
        !            94:        fi
        !            95:         eval time$suf=$t
        !            96:       fi
        !            97:       if test -z "$pat"; then
        !            98:         wr "TIME=$time";
        !            99:       else
        !           100:         eval BUG$suf=BUG
        !           101:         eval files$suf=\"'$'files$suf $file_diff\"
        !           102:         wr "BUG [${time:-0}]"
        !           103:       fi
        !           104:     done
        !           105:     wrln
        !           106:   fi
        !           107: done
        !           108: $RM $file_test
        !           109: BUG=
        !           110: for suf in $SUF; do
        !           111:   B=`eval echo '$'BUG$suf`; BUG="$BUG$B"
        !           112:   t=`eval echo '$'time$suf`
        !           113:   if test -n "$B"; then B=' [BUG]'; fi
        !           114:   wrln "+++$B Total bench for gp-$suf is $t"
        !           115: done
        !           116: if test -z "$BUG"; then exit 0; fi
        !           117:
        !           118: pwd=`pwd`
        !           119: wrln
        !           120: wrln "PROBLEMS WERE NOTED. The following files list them in diff format: "
        !           121: wrln "Directory: $pwd"
        !           122: bugp=; buge=;
        !           123: for suf in $SUF; do
        !           124:   B=`eval echo '$'BUG$suf`; BUG="$BUG$B"
        !           125:   if test -n "$B"; then
        !           126:     flist=`eval echo '$'files$suf`
        !           127:     for f in $flist; do
        !           128:       wrln "   $f"
        !           129:       case "$f" in
        !           130:         *program*)  bugp="$suf$bugp";;
        !           131:         *elliptic*) buge="$suf$buge";;
        !           132:       esac
        !           133:     done
        !           134:   fi
        !           135: done
        !           136:
        !           137: case "$buge" in
        !           138:   *) end=""
        !           139:        file_diff=elliptic-sta.dif;;
        !           140:   sta|dyn)
        !           141:        end=" (gp-$buge only)"
        !           142:        file_diff=elliptic-$buge.dif;;
        !           143:   exe)
        !           144:        end=" (gp-$buge)"
        !           145:        file_diff=elliptic.dif;;
        !           146: esac
        !           147: len=`wc -l $file_diff | sed -e 's/ *\([0-9]*\).*/\1/'`
        !           148: pat=`head -4 $file_diff|tail -1|grep "141,154"`
        !           149: if test $len -eq 46  -a  -n "$pat"; then
        !           150: cat << EOT
        !           151: NOTE: the problem noted in 'elliptic' boils down to different FPU and
        !           152: compiler optimizations than on our test machine. It can safely be ignored,
        !           153: the difference being insignificant given the requested precision.
        !           154: EOT
        !           155: fi
        !           156:
        !           157: case "$bugp" in
        !           158:   *) end=""
        !           159:        file_diff=program-sta.dif;;
        !           160:   sta|dyn)
        !           161:        end=" (gp-$bugp only)"
        !           162:        file_diff=program-$bugp.dif;;
        !           163:   exe)
        !           164:        end=" (gp-$bugp)"
        !           165:        file_diff=program.dif;;
        !           166: esac
        !           167: len=`wc -l $file_diff | sed -e 's/ *\([0-9]*\).*/\1/'`
        !           168: pat=`head -4 $file_diff|tail -1|grep "108,118"`
        !           169: if test $len -eq 29  -a  -n "$pat"; then
        !           170: cat << EOT
        !           171: NOTE: the problem noted in 'program' is that install() does not work in your
        !           172: configuration$end, so you will not be able to use this feature. Otherwise you
        !           173: can safely ignore the above warning.
        !           174: EOT
        !           175: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>