Add heuristic to take shortcut when too slow.
[wiggle/upstream.git] / dovtest
blobbcb3c65d469c233aeb2855390108d07d12c9dda4
1 #!/usr/bin/env bash
3 dir=$PWD
5 while [ ! -f $dir/wiggle ]
6 do
7 if [ -z "$dir" ]; then
8 echo >&2 Cannot find wiggle program : $WIGGLE
9 exit 1
11 dir=${dir%/*}
12 done
13 export WIGGLE=$dir/wiggle
15 if [ -d tests ]
16 then cd tests
19 vallog=/tmp/valg.log-$$
20 > $vallog
21 VG="valgrind --log-file=$vallog"
23 status=0
24 ok=0
25 fail=0
27 find . -name core | xargs rm -f
28 list=$(find . -type f -name merge )
30 WIGGLE="$WIGGLE --self-test"
31 for path in $list
33 dir=${path%/*}
35 cd $dir
37 if [ -f patch ]
38 then $VG $WIGGLE -B orig patch
39 elif [ -f new ]
40 then $VG $WIGGLE -B orig new new2
41 else $VG $WIGGLE -B orig
43 if grep 'ERROR SUMMARY: [1-9]' $vallog > /dev/null 2>&1
44 then msg="VALGRIND ERRORS"; xit=1 ; mv $vallog $vallog-${dir////-}
45 else msg="SUCCESS"; xit=0
47 echo $path $msg
48 exit $xit
50 if [ $? = 0 ]
51 then let ok++;
52 else status=1 ; let fail++
54 done
55 find . -name core -ls
56 echo $ok succeeded and $fail failed
57 exit $status