File: run_test.sh

package info (click to toggle)
diffstat 1.39-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 532 kB
  • ctags: 120
  • sloc: sh: 2,769; ansic: 1,102; makefile: 130
file content (42 lines) | stat: -rwxr-xr-x 942 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
#!/bin/sh
# $Id: run_test.sh,v 1.9 2005/01/16 17:58:00 Eric.Blake Exp $
# Test-script for DIFFSTAT
if [ $# = 0 ]
then
	eval '"$0" *.pat'
	exit
fi
PATH=`cd ..;pwd`:$PATH; export PATH
# Sanity check, remembering that not every system has `which'.
(which diffstat) >/dev/null 2>/dev/null && echo "Checking `which diffstat`"

for item in $*
do
	echo "testing `basename $item .pat`"
	for OPTS in "" "-p1" "-p9" "-f0" "-u" "-k"
	do
		NAME=`echo $item | sed -e 's/.pat$//'`
		DATA=$NAME.pat
		if [ ".$OPTS" != "." ] ; then
			NAME=$NAME`echo ./$OPTS|sed -e 's@./-@@'`
		fi
		TEST=`basename $NAME`
		diffstat -e $TEST.err -o $TEST.out $OPTS $DATA
		if [ -f $NAME.ref ]
		then
			if ( cmp -s $TEST.out $NAME.ref )
			then
				echo "** ok: $TEST"
				rm -f $TEST.out
				rm -f $TEST.err
			else
				echo "?? fail: $TEST"
				diff -b $NAME.ref $TEST.out
			fi
		else
			echo "** save: $TEST"
			mv $TEST.out $NAME.ref
			rm -f $TEST.err
		fi
	done
done