comparison tests/run-tests @ 362:410373162036

run-tests: run tests given on the command line -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 run-tests: run tests given on the command line manifest hash: e0217e478de902d0de7b9a294509718365f1d837 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCsL7EywK+sNU5EO8RAiGJAJ92ZB/+N8+XnOt717cuADK9ajQ+lwCfW1LG 02mjQ04uoS0n+D8xi0KX9tM= =d1lZ -----END PGP SIGNATURE-----
author mpm@selenic.com
date Wed, 15 Jun 2005 15:50:28 -0800
parents b4e0e20646bb
children 37249c522770
comparison
equal deleted inserted replaced
361:88268aa2b8d2 362:410373162036
4 4
5 tests=0 5 tests=0
6 failed=0 6 failed=0
7 H=$PWD 7 H=$PWD
8 8
9 for f in `ls test-* | grep -Ev "\.|~"` ; do 9 function run_one
10 echo -n "." 10 {
11 D=`mktemp -d` 11 D=`mktemp -d`
12 if [ "$D" == "" ] ; then 12 if [ "$D" == "" ] ; then
13 echo mktemp failed! 13 echo mktemp failed!
14 fi 14 fi
15 15
16 cd $D 16 cd $D
17 fail=0 17 fail=0
18
18 if ! $H/$f > .out 2>&1 ; then 19 if ! $H/$f > .out 2>&1 ; then
19 echo $f failed with error code $? 20 echo $f failed with error code $?
20 fail=1 21 fail=1
21 fi 22 fi
23
22 if [ -s .out -a ! -r $H/$f.out ] ; then 24 if [ -s .out -a ! -r $H/$f.out ] ; then
23 echo $f generated unexpected output: 25 echo $f generated unexpected output:
24 cat .out 26 cat .out
25 cp .out $H/$f.err 27 cp .out $H/$f.err
26 fail=1 28 fail=1
27 elif ! diff -u $H/$f.out .out > /dev/null ; then 29 elif [ -r $H/$f.out ] && ! diff -u $H/$f.out .out > /dev/null ; then
28 echo $f output changed: 30 echo $f output changed:
29 diff -u $H/$f.out .out && true 31 diff -u $H/$f.out .out && true
30 cp .out $H/$f.err 32 cp .out $H/$f.err
31 fail=1 33 fail=1
32 fi 34 fi
33 35
34 cd $H 36 cd $H
35 rm -r $D 37 rm -r $D
38 return $fail
39 }
36 40
37 failed=$[$failed + $fail] 41 TESTS=$@
42 if [ "$TESTS" == "" ] ; then
43 TESTS=`ls test-* | grep -Ev "\.|~"`
44 fi
45
46 for f in $TESTS ; do
47 echo -n "."
48 if ! run_one $f ; then
49 failed=$[$failed + 1]
50 fi
38 tests=$[$tests + 1] 51 tests=$[$tests + 1]
39 done 52 done
40 53
41 echo 54 echo
42 echo Ran $tests tests, $failed failed 55 echo Ran $tests tests, $failed failed