Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/run-tests @ 380:c72ccad3e3b8
Merge with TAH
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Merge with TAH
manifest hash: 18cf61cc2b6611d74ffc490b6b733537b879d69e
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCsQy7ywK+sNU5EO8RAoi/AKCC0XbK73oemLr52KOQWEK4WlE9pgCgkk/8
C/m6MZJqlOKhIT4jazPwngU=
=ECGy
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Wed, 15 Jun 2005 21:23:07 -0800 |
parents | 410373162036 |
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 |