Mercurial > hg
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 |
rev | line source |
---|---|
331 | 1 #!/bin/bash |
2 | |
3 set -e | |
4 | |
5 tests=0 | |
6 failed=0 | |
7 H=$PWD | |
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 | 12 D=`mktemp -d` |
13 if [ "$D" == "" ] ; then | |
14 echo mktemp failed! | |
15 fi | |
16 | |
17 cd $D | |
18 fail=0 | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
19 |
331 | 20 if ! $H/$f > .out 2>&1 ; then |
21 echo $f failed with error code $? | |
22 fail=1 | |
23 fi | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
24 |
331 | 25 if [ -s .out -a ! -r $H/$f.out ] ; then |
26 echo $f generated unexpected output: | |
27 cat .out | |
28 cp .out $H/$f.err | |
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 | 31 echo $f output changed: |
32 diff -u $H/$f.out .out && true | |
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 | 35 fi |
36 | |
37 cd $H | |
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 | 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 | 52 tests=$[$tests + 1] |
53 done | |
54 | |
55 echo | |
56 echo Ran $tests tests, $failed failed | |
57 | |
58 if [ $failed -gt 0 ] ; then | |
59 exit 1 | |
60 fi | |
61 |