annotate tests/run-tests @ 425:719663b7f235

remember_version() only writes version if called in a Mercurial repository. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 remember_version() only writes version if called in a Mercurial repository. forget_version() resets version only if remember_version() wrote it. manifest hash: b30df9d93c233f4bf07150cc5067f294a98c16f4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFCtXFiW7P1GVgWeRoRAgkjAJ9jkwCAHf3yJyDI8R582XjNFNFeWgCZAe27 iqGPYzrRErf6gPKZcoBMsD4= =t2Bx -----END PGP SIGNATURE-----
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 19 Jun 2005 14:21:38 +0100
parents 37249c522770
children e5683db23ec4 688d03d6997a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
1 #!/bin/bash
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
2
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
3 set -e
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
4
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
5 tests=0
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
6 failed=0
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
7 H=$PWD
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
8
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
9 function run_one
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
10 {
382
37249c522770 test suite: fix timezone problems and port collision problem
mpm@selenic.com
parents: 362
diff changeset
11 export TZ=GMT
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
12 D=`mktemp -d`
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
13 if [ "$D" == "" ] ; then
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
14 echo mktemp failed!
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
15 fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
16
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
17 cd $D
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
18 fail=0
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
19
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
20 if ! $H/$f > .out 2>&1 ; then
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
21 echo $f failed with error code $?
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
22 fail=1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
23 fi
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
24
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
25 if [ -s .out -a ! -r $H/$f.out ] ; then
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
26 echo $f generated unexpected output:
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
27 cat .out
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
28 cp .out $H/$f.err
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
29 fail=1
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
30 elif [ -r $H/$f.out ] && ! diff -u $H/$f.out .out > /dev/null ; then
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
31 echo $f output changed:
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
32 diff -u $H/$f.out .out && true
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
33 cp .out $H/$f.err
341
c0deea64ce64 run-tests: actually mark changed output as failure
mpm@selenic.com
parents: 331
diff changeset
34 fail=1
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
35 fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
36
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
37 cd $H
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
38 rm -r $D
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
39 return $fail
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
40 }
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
41
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
42 TESTS=$@
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
43 if [ "$TESTS" == "" ] ; then
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
44 TESTS=`ls test-* | grep -Ev "\.|~"`
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
45 fi
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
46
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
47 for f in $TESTS ; do
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
48 echo -n "."
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
49 if ! run_one $f ; then
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
50 failed=$[$failed + 1]
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
51 fi
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
52 tests=$[$tests + 1]
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
53 done
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
54
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
55 echo
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
56 echo Ran $tests tests, $failed failed
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
57
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
58 if [ $failed -gt 0 ] ; then
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
59 exit 1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
60 fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
61