Mercurial > hg
annotate 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 |
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 { |
331 | 11 D=`mktemp -d` |
12 if [ "$D" == "" ] ; then | |
13 echo mktemp failed! | |
14 fi | |
15 | |
16 cd $D | |
17 fail=0 | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
18 |
331 | 19 if ! $H/$f > .out 2>&1 ; then |
20 echo $f failed with error code $? | |
21 fail=1 | |
22 fi | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
23 |
331 | 24 if [ -s .out -a ! -r $H/$f.out ] ; then |
25 echo $f generated unexpected output: | |
26 cat .out | |
27 cp .out $H/$f.err | |
28 fail=1 | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
29 elif [ -r $H/$f.out ] && ! diff -u $H/$f.out .out > /dev/null ; then |
331 | 30 echo $f output changed: |
31 diff -u $H/$f.out .out && true | |
32 cp .out $H/$f.err | |
341
c0deea64ce64
run-tests: actually mark changed output as failure
mpm@selenic.com
parents:
331
diff
changeset
|
33 fail=1 |
331 | 34 fi |
35 | |
36 cd $H | |
37 rm -r $D | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
38 return $fail |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
39 } |
331 | 40 |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
41 TESTS=$@ |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
42 if [ "$TESTS" == "" ] ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
43 TESTS=`ls test-* | grep -Ev "\.|~"` |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
44 fi |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
45 |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
46 for f in $TESTS ; do |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
47 echo -n "." |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
48 if ! run_one $f ; then |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
49 failed=$[$failed + 1] |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
50 fi |
331 | 51 tests=$[$tests + 1] |
52 done | |
53 | |
54 echo | |
55 echo Ran $tests tests, $failed failed | |
56 | |
57 if [ $failed -gt 0 ] ; then | |
58 exit 1 | |
59 fi | |
60 |