File: dotest

package info (click to toggle)
wiggle 1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,036 kB
  • sloc: ansic: 13,649; sh: 1,180; makefile: 194
file content (123 lines) | stat: -rwxr-xr-x 3,036 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/usr/bin/env bash

# Redirect for non-GNU time systems
if [ "xx$TIME_CMD" = "xx" ]
then
  time_cmd=/usr/bin/time
else
  time_cmd=$TIME_CMD
fi

dir=$PWD

while [ ! -f $dir/wiggle ]
do
  if [ -z "$dir" ]; then
    echo >&2 Cannot find wiggle program : $WIGGLE
    exit 1
  fi
  dir=${dir%/*}
done
export WIGGLE=$dir/wiggle

if [ -d tests ]
then cd tests
fi

TIME="$time_cmd -o .time -f %U"
if $TIME true > /dev/null 2>&1
then :
else TIME=
fi
vallog=/tmp/valg.log-$$
> $vallog
if [ " $1" = " valgrind" ]; then
  TIME="valgrind --log-file=$vallog"
fi
status=0
ok=0
fail=0

# Avoid non-determinism cause by CPU speed
export WIGGLE_LOOPCOUNT=5000

find . -name core | xargs rm -f
list=$(find . -type f \( -name script -o -name diff -o -name ldiff \
	-o -name rediff -o -name merge -o -name wmerge -o -name lmerge \
        -o -name replace -o -name Wmerge -o -name bmerge \)
      )
for path in $list
do
  dir=${path%/*}
  base=${path##*/}
  (
    cd $dir
    > .time
    case $base in 
	script ) ./script ;;
	diff ) if [ -f new ]
		then $TIME $WIGGLE -dw orig new | diff -u diff - ; xit=$?
		else $TIME $WIGGLE -dwp1 orig patch | diff -u diff - ; xit=$?
		fi
		;;
	ldiff ) if [ -f new ]
		then $TIME $WIGGLE -dl orig new | diff -u ldiff - ; xit=$?
		else $TIME $WIGGLE -dlp1 orig patch | diff -u ldiff - ; xit=$?
		fi
		;;
	reldiff ) $TIME $WIGGLE -dl patch | diff -u reldiff - ; xit=$?
		;;
	rediff ) $TIME $WIGGLE -dw patch | diff -u rediff - ; xit=$?
		;;
	merge )  if [ -f patch ]
		 then $TIME $WIGGLE -m orig patch | diff -u merge - ; xit=$?
		 elif [ -f new ] 
                 then $TIME $WIGGLE -m orig new new2 | diff -u merge - ; xit=$?
		 else $TIME $WIGGLE -m orig | diff -u merge - ; xit=$?
		 fi
		;;
	replace ) cp orig orig.tmp
		 if [ -f patch ]
		 then $TIME $WIGGLE -mr orig.tmp patch 
		 else $TIME $WIGGLE -mr orig.tmp new new2
		 fi
		 diff -u merge orig.tmp ; xit=$?
		 rm  orig.tmp orig.tmp.porig
		;;
	lmerge )  if [ -f patch ]
		 then $TIME $WIGGLE -ml orig patch | diff -u lmerge - ; xit=$?
		 else $TIME $WIGGLE -ml orig new new2 | diff -u lmerge - ; xit=$?
		 fi
		 ;;
	wmerge )  if [ -f patch ]
		 then $TIME $WIGGLE -mw orig patch | diff -u wmerge - ; xit=$?
		 else $TIME $WIGGLE -mw orig new new2 | diff -u wmerge - ; xit=$?
		 fi
		 ;;
	Wmerge )  if [ -f patch ]
		 then $TIME $WIGGLE -mW orig patch | diff -u Wmerge - ; xit=$?
		 else $TIME $WIGGLE -mW orig new new2 | diff -u Wmerge - ; xit=$?
		 fi
		 ;;
	bmerge )  if [ -f patch ]
		 then $TIME $WIGGLE -mbw orig patch | diff -u bmerge - ; xit=$?
		 else $TIME $WIGGLE -mbw orig new new2 | diff -u bmerge - ; xit=$?
		 fi
		 ;;
   esac
   if [ $xit = 0 ]; then msg=SUCCEEDED; else msg=FAILED; fi
   if grep 'ERROR SUMMARY: [1-9]' $vallog > /dev/null 2>&1
   then msg="$msg WITH VALGRIND ERRORS"; xit=1
   fi
   echo $path $msg `grep -v 'Command exited' .time 2> /dev/null`
   rm -f .time
   exit $xit
  ) 
  if [ $? = 0 ]
  then let ok++; 
  else status=1 ; let fail++ 
  fi
done
find . -name core -ls
echo $ok succeeded and $fail failed
exit $status