Browser: improve rendering of conflicts in the the 'merge' view.
[wiggle/upstream.git] / dotest
blob18fdf05ccc6e586df6a53201300d2da37de947af
1 #!/bin/bash
3 # Redirect for non-GNU time systems
4 if [ "xx$TIME_CMD" = "xx" ]
5 then
6 time_cmd=/usr/bin/time
7 else
8 time_cmd=$TIME_CMD
9 fi
11 dir=$PWD
13 while [ ! -f $dir/wiggle ]
15 case $dir in
16 / ) echo >&2 Cannot find wiggle program : $WIGGLE
17 exit 1;;
18 * ) dir=${dir%/*}
19 esac
20 done
21 export WIGGLE=$dir/wiggle
23 if [ -d tests ]
24 then cd tests
27 TIME="$time_cmd -o .time -f %U"
28 if $TIME true > /dev/null 2>&1
29 then :
30 else TIME=
32 #TIME=valgrind
33 status=0
34 ok=0
35 fail=0
37 find . -name core | xargs rm -f
38 list=$(find . -type f \( -name script -o -name diff -o -name ldiff \
39 -o -name rediff -o -name merge -o -name wmerge -o -name lmerge \
40 -o -name replace -o -name Wmerge \)
42 for path in $list
44 dir=${path%/*}
45 base=${path##*/}
47 cd $dir
48 > .time
49 case $base in
50 script ) ./script ;;
51 diff ) if [ -f new ]
52 then $TIME $WIGGLE -dw orig new | diff -u diff - ; xit=$?
53 else $TIME $WIGGLE -dwp1 orig patch | diff -u diff - ; xit=$?
56 ldiff ) if [ -f new ]
57 then $TIME $WIGGLE -dl orig new | diff -u ldiff - ; xit=$?
58 else $TIME $WIGGLE -dlp1 orig patch | diff -u ldiff - ; xit=$?
61 reldiff ) $TIME $WIGGLE -dl patch | diff -u reldiff - ; xit=$?
63 rediff ) $TIME $WIGGLE -dw patch | diff -u rediff - ; xit=$?
65 merge ) if [ -f patch ]
66 then $TIME $WIGGLE -m orig patch | diff -u merge - ; xit=$?
67 elif [ -f new ]
68 then $TIME $WIGGLE -m orig new new2 | diff -u merge - ; xit=$?
69 else $TIME $WIGGLE -m orig | diff -u merge - ; xit=$?
72 replace ) cp orig orig.tmp
73 if [ -f patch ]
74 then $TIME $WIGGLE -mr orig.tmp patch
75 else $TIME $WIGGLE -mr orig.tmp new new2
77 diff -u merge orig.tmp ; xit=$?
78 rm orig.tmp orig.tmp.porig
80 lmerge ) if [ -f patch ]
81 then $TIME $WIGGLE -ml orig patch | diff -u lmerge - ; xit=$?
82 else $TIME $WIGGLE -ml orig new new2 | diff -u lmerge - ; xit=$?
85 wmerge ) if [ -f patch ]
86 then $TIME $WIGGLE -mw orig patch | diff -u wmerge - ; xit=$?
87 else $TIME $WIGGLE -mw orig new new2 | diff -u wmerge - ; xit=$?
90 Wmerge ) if [ -f patch ]
91 then $TIME $WIGGLE -mW orig patch | diff -u Wmerge - ; xit=$?
92 else $TIME $WIGGLE -mW orig new new2 | diff -u Wmerge - ; xit=$?
95 esac
96 if [ $xit = 0 ]; then msg=SUCCEEDED; else msg=FAILED; fi
97 echo $path $msg `grep -v 'Command exited' .time 2> /dev/null`
98 rm -f .time
99 exit $xit
101 if [ $? = 0 ]
102 then let ok++;
103 else status=1 ; let fail++
105 done
106 find . -name core -ls
107 echo $ok succeeded and $fail failed
108 exit $status