Annotation of OpenXM_contrib/pari/src/test/dotest, Revision 1.1.1.1
1.1 maekawa 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-$version.$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 -n "$BUG"; then
117: pwd=`pwd`
118: wrln
119: wrln "PROBLEMS WERE NOTED. The following files list them in diff format: "
120: wrln "Directory: $pwd"
121: lastnote=ok; bug=
122: for suf in $SUF; do
123: B=`eval echo '$'BUG$suf`; BUG="$BUG$B"
124: if test -n "$B"; then
125: flist=`eval echo '$'files$suf`
126: for f in $flist; do
127: case "$f" in
128: *program*) if test -n "$bug"; then bug=all; else bug=$suf; fi;;
129: *) lastnote="";;
130: esac
131: wrln " $f"
132: done
133: fi
134: done
135: if test -n "$lastnote"; then
136: case "$bug" in
137: all) end=""
138: file_diff=program-sta.dif;;
139: sta|dyn)
140: end=" (gp-$bug only)"
141: file_diff=program-$bug.dif;;
142: exe)
143: end=" (gp-$bug)"
144: file_diff=program.dif;;
145: esac
146: pat=`head -4 $file_diff|tail -1|grep "108,118"`
147: if test -n "$pat"; then
148: cat << EOT
149: NOTE: actually, the only problem noted is that install() does not work
150: in your configuration$end, so you will not be able to use
151: this feature. Otherwise you can safely ignore the above warning.
152: EOT
153: fi
154: fi
155: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>