Remove all trailing blanks.
[wiggle/upstream.git] / dotest
blob6d3a27e893c65916808408cd9b5856ddfb90c257
1 #!/bin/bash
3 dir=$PWD
5 while [ ! -f $dir/wiggle ]
6 do
7 case $dir in
8 / ) echo >&2 Cannot find wiggle program : $WIGGLE
9 exit 1;;
10 * ) dir=${dir%/*}
11 esac
12 done
13 export WIGGLE=$dir/wiggle
15 if [ -d tests ]
16 then cd tests
19 status=0
20 ok=0
21 fail=0
23 find . -name core | xargs rm -f
24 list=$(find . -type f \( -name script -o -name diff -o -name ldiff \
25 -o -name rediff -o -name merge -o -name wmerge -o -name lmerge -o -name replace \)
27 for path in $list
29 dir=${path%/*}
30 base=${path##*/}
32 cd $dir
33 > .time
34 case $base in
35 script ) ./script ;;
36 diff ) if [ -f new ]
37 then /usr/bin/time -o .time -f '%U' $WIGGLE -dw orig new | diff -u diff - ; xit=$?
38 else /usr/bin/time -o .time -f '%U' $WIGGLE -dwp1 orig patch | diff -u diff - ; xit=$?
41 ldiff ) if [ -f new ]
42 then /usr/bin/time -o .time -f '%U' $WIGGLE -dl orig new | diff -u ldiff - ; xit=$?
43 else /usr/bin/time -o .time -f '%U' $WIGGLE -dlp1 orig patch | diff -u ldiff - ; xit=$?
46 reldiff ) /usr/bin/time -o .time -f '%U' $WIGGLE -dl patch | diff -u reldiff - ; xit=$?
48 rediff ) /usr/bin/time -o .time -f '%U' $WIGGLE -dw patch | diff -u rediff - ; xit=$?
50 merge ) if [ -f patch ]
51 then /usr/bin/time -o .time -f '%U' $WIGGLE -m orig patch | diff -u merge - ; xit=$?
52 elif [ -f new ]
53 then /usr/bin/time -o .time -f '%U' $WIGGLE -m orig new new2 | diff -u merge - ; xit=$?
54 else /usr/bin/time -o .time -f '%U' $WIGGLE -m orig | diff -u merge - ; xit=$?
57 replace ) cp orig orig.tmp
58 if [ -f patch ]
59 then /usr/bin/time -o .time -f '%U' $WIGGLE -mr orig.tmp patch
60 else /usr/bin/time -o .time -f '%U' $WIGGLE -mr orig.tmp new new2
62 diff -u merge orig.tmp ; xit=$?
63 rm orig.tmp orig.tmp.porig
65 lmerge ) if [ -f patch ]
66 then /usr/bin/time -o .time -f '%U' $WIGGLE -ml orig patch | diff -u lmerge - ; xit=$?
67 else /usr/bin/time -o .time -f '%U' $WIGGLE -ml orig new new2 | diff -u lmerge - ; xit=$?
70 wmerge ) if [ -f patch ]
71 then /usr/bin/time -o .time -f '%U' $WIGGLE -mw orig patch | diff -u wmerge - ; xit=$?
72 else /usr/bin/time -o .time -f '%U' $WIGGLE -mw orig new new2 | diff -u wmerge - ; xit=$?
75 esac
76 if [ $xit = 0 ]; then msg=SUCCEEDED; else msg=FAILED; fi
77 echo $path $msg `grep -v 'Command exited' .time 2> /dev/null`
78 rm -f .time
79 exit $xit
81 if [ $? = 0 ]
82 then let ok++;
83 else status=1 ; let fail++
85 done
86 find . -name core -ls
87 echo $ok succeeded and $fail failed
88 exit $status