Mercurial > hg > mercurial-crew-with-dirclash
annotate tests/run-tests @ 1672:07f931af5f40
add documentation for email command.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Tue, 31 Jan 2006 08:14:23 -0800 |
parents | 651690fe6be3 |
children | a5c46cff620f 7d83a351a936 |
rev | line source |
---|---|
544
3d4d5f2aba9a
Remove bashisms and use /bin/sh instead of /bin/bash.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
495
diff
changeset
|
1 #!/bin/sh -e |
331 | 2 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
3 LANG="C"; export LANG |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
4 LC_CTYPE="C"; export LC_CTYPE |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
5 LC_NUMERIC="C"; export LC_NUMERIC |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
6 LC_TIME="C"; export LC_TIME |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
7 LC_COLLATE="C"; export LC_COLLATE |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
8 LC_MONETARY="C"; export LC_MONETARY |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
9 LC_MESSAGES="C"; export LC_MESSAGES |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
10 LC_PAPER="C"; export LC_PAPER |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
11 LC_NAME="C"; export LC_NAME |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
12 LC_ADDRESS="C"; export LC_ADDRESS |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
13 LC_TELEPHONE="C"; export LC_TELEPHONE |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
14 LC_MEASUREMENT="C"; export LC_MEASUREMENT |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
15 LC_IDENTIFICATION="C"; export LC_IDENTIFICATION |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
16 LC_ALL=""; export LC_ALL |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
17 TZ=GMT; export TZ |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
18 HGEDITOR=true; export HGEDITOR |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
19 HGMERGE=true; export HGMERGE |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
20 HGUSER="test"; export HGUSER |
488
77c66c4eec0e
[PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents:
473
diff
changeset
|
21 |
489 | 22 umask 022 |
23 | |
331 | 24 tests=0 |
25 failed=0 | |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
26 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
27 HGTMP="" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
28 cleanup_exit() { |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
29 rm -rf "$HGTMP" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
30 } |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
31 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
32 # Remove temporary files even if we get interrupted |
835
9de3535caae8
Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
833
diff
changeset
|
33 trap "cleanup_exit" 0 # normal exit |
9de3535caae8
Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
833
diff
changeset
|
34 trap "exit 255" 1 2 3 6 15 # HUP INT QUIT ABRT TERM |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
35 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
36 HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
37 (umask 077 && mkdir "$HGTMP") || { |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
38 echo "Could not create temporary directory! Exiting." 1>&2 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
39 exit 1 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
40 } |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
41 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
42 TESTDIR="$PWD" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
43 INST="$HGTMP/install" |
1558
651690fe6be3
fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents:
1308
diff
changeset
|
44 PYTHONDIR="$INST/lib/python" |
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
45 cd .. |
1558
651690fe6be3
fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents:
1308
diff
changeset
|
46 if ${PYTHON-python} setup.py install --home="$INST" \ |
651690fe6be3
fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents:
1308
diff
changeset
|
47 --install-lib="$PYTHONDIR" > tests/install.err 2>&1 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
48 then |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
49 rm tests/install.err |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
50 else |
398 | 51 cat tests/install.err |
835
9de3535caae8
Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
833
diff
changeset
|
52 exit 1 |
398 | 53 fi |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
54 cd "$TESTDIR" |
397
e5683db23ec4
From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents:
382
diff
changeset
|
55 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
56 PATH="$INST/bin:$PATH"; export PATH |
1558
651690fe6be3
fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents:
1308
diff
changeset
|
57 PYTHONPATH="$PYTHONDIR"; export PYTHONPATH |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
58 |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
59 run_one() { |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
60 rm -f "$1.err" |
331 | 61 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
62 mkdir "$HGTMP/$1" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
63 cd "$HGTMP/$1" |
331 | 64 fail=0 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
65 HOME="$HGTMP/$1"; export HOME |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
66 OUT="$HGTMP/$1.out" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
67 OUTOK="$TESTDIR/$1.out" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
68 ERR="$TESTDIR/$1.err" |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
69 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
70 if "$TESTDIR/$1" > "$OUT" 2>&1; then |
803
3d47e7fc33a3
Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
802
diff
changeset
|
71 : no error |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
72 else |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
73 echo "$1 failed with error code $?" |
331 | 74 fail=1 |
75 fi | |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
76 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
77 if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
78 cp "$OUT" "$ERR" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
79 echo |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
80 echo "$1 generated unexpected output:" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
81 cat "$ERR" |
331 | 82 fail=1 |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
83 elif [ -r "$OUTOK" ]; then |
803
3d47e7fc33a3
Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
802
diff
changeset
|
84 if diff -u "$OUTOK" "$OUT" > /dev/null; then |
3d47e7fc33a3
Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
802
diff
changeset
|
85 : no differences |
3d47e7fc33a3
Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
802
diff
changeset
|
86 else |
833
ad8ff3534fde
Removed special FIXME handling in run-tests, added bug info to .out files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
87 cp "$OUT" "$ERR" |
ad8ff3534fde
Removed special FIXME handling in run-tests, added bug info to .out files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
88 echo |
ad8ff3534fde
Removed special FIXME handling in run-tests, added bug info to .out files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
89 echo "$1 output changed:" |
ad8ff3534fde
Removed special FIXME handling in run-tests, added bug info to .out files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
90 diff -u "$OUTOK" "$ERR" || true |
ad8ff3534fde
Removed special FIXME handling in run-tests, added bug info to .out files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
814
diff
changeset
|
91 fail=1 |
803
3d47e7fc33a3
Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
802
diff
changeset
|
92 fi |
331 | 93 fi |
94 | |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
95 cd "$TESTDIR" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
96 rm -f "$HGTMP/$1.out" |
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
97 rm -rf "$HGTMP/$1" |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
98 return $fail |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
99 } |
331 | 100 |
1308
2073e5a71008
Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1279
diff
changeset
|
101 # list of prerequisite programs |
1279
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
102 # stuff from coreutils (cat, rm, etc) are not tested |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
103 prereqs="python merge diff grep unzip md5sum gunzip sed" |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
104 missing='' |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
105 for pre in $prereqs ; do |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
106 if type $pre > /dev/null 2>&1 ; then |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
107 : prereq exists |
1308
2073e5a71008
Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1279
diff
changeset
|
108 else |
1279
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
109 missing="$pre $missing" |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
110 fi |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
111 done |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
112 |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
113 if [ "$missing" != '' ] ; then |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
114 echo "ERROR: the test suite needs some programs to execute correctly." |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
115 echo "The following programs are missing: " |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
116 for pre in $missing; do |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
117 echo " $pre" |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
118 done |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
119 exit 1 |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
120 fi |
8ab1c07d4e0b
Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents:
925
diff
changeset
|
121 |
804
19388dcbac49
Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
803
diff
changeset
|
122 TESTS="$*" |
798
c28f9feb7c2e
Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
793
diff
changeset
|
123 if [ -z "$TESTS" ] ; then |
804
19388dcbac49
Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
803
diff
changeset
|
124 TESTS=`ls test-* | grep -v "[.~]"` |
362
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
125 fi |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
126 |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
127 for f in $TESTS ; do |
410373162036
run-tests: run tests given on the command line
mpm@selenic.com
parents:
350
diff
changeset
|
128 echo -n "." |
804
19388dcbac49
Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
803
diff
changeset
|
129 run_one $f || failed=`expr $failed + 1` |
19388dcbac49
Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
803
diff
changeset
|
130 tests=`expr $tests + 1` |
331 | 131 done |
132 | |
133 echo | |
804
19388dcbac49
Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
803
diff
changeset
|
134 echo "Ran $tests tests, $failed failed." |
331 | 135 |
136 if [ $failed -gt 0 ] ; then | |
835
9de3535caae8
Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
833
diff
changeset
|
137 exit 1 |
331 | 138 fi |
835
9de3535caae8
Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
833
diff
changeset
|
139 exit 0 |