annotate tests/run-tests @ 2156:628bf85f07ee

merge with crew.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 28 Apr 2006 15:50:56 -0700
parents 15ec724ba351
children 278f9b13c39a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2068
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
2 #
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
3 # environment variables:
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
4 #
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
5 # TEST_COVERAGE - set non-empty if you want to print test coverage report
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
6 # COVERAGE_STDLIB - set non-empty to report coverage of standard library
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
7
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
8 LANG="C"; export LANG
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
9 LC_CTYPE="C"; export LC_CTYPE
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
10 LC_NUMERIC="C"; export LC_NUMERIC
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
11 LC_TIME="C"; export LC_TIME
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
12 LC_COLLATE="C"; export LC_COLLATE
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
13 LC_MONETARY="C"; export LC_MONETARY
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
14 LC_MESSAGES="C"; export LC_MESSAGES
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
15 LC_PAPER="C"; export LC_PAPER
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
16 LC_NAME="C"; export LC_NAME
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
17 LC_ADDRESS="C"; export LC_ADDRESS
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
18 LC_TELEPHONE="C"; export LC_TELEPHONE
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
19 LC_MEASUREMENT="C"; export LC_MEASUREMENT
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
20 LC_IDENTIFICATION="C"; export LC_IDENTIFICATION
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
21 LC_ALL=""; export LC_ALL
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
22 TZ=GMT; export TZ
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
23 HGEDITOR=true; export HGEDITOR
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
24 HGMERGE=true; export HGMERGE
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
25 HGUSER="test"; export HGUSER
1951
696230e52e4d add HGRCPATH env var, list of places to look for hgrc files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 1949
diff changeset
26 HGRCPATH=""; export HGRCPATH
2059
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
27 OS=`uname`
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
28
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
29 case "$OS" in
2060
676f5fd84a94 Don't use -u option for diff on SunOS, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2059
diff changeset
30 HP-UX|SunOS)
2059
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
31 DIFFOPTS=
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
32 ;;
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
33 *)
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
34 DIFFOPTS=-u
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
35 ;;
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
36 esac
488
77c66c4eec0e [PATCH] Set locale before run-tests does anything
mpm@selenic.com
parents: 473
diff changeset
37
2023
3bdd3bf17cfa Use [ x = y ] instead of [ x == y ] in shell scripts.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1952
diff changeset
38 if [ `echo -n HG` = "-n HG" ]
1952
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
39 then
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
40 ECHO_N=echo
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
41 NNL="\c"
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
42 else
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
43 ECHO_N="echo -n"
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
44 NNL=
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
45 fi
1925
c71420b186b0 small solaris portability fixes from John Levon <levon@movementarian.org>
Peter van Dijk <peter@dataloss.nl>
parents: 1923
diff changeset
46
489
a636f7d2cd5b [PATCH] umask for run-tests
mpm@selenic.com
parents: 488
diff changeset
47 umask 022
a636f7d2cd5b [PATCH] umask for run-tests
mpm@selenic.com
parents: 488
diff changeset
48
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
49 tests=0
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
50 failed=0
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
51
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
52 HGTMP=""
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
53 cleanup_exit() {
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
54 rm -rf "$HGTMP"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
55 }
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
56
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
57 # 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
58 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
59 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
60
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
61 HGTMP="${TMPDIR-/tmp}/hgtests.$RANDOM.$RANDOM.$RANDOM.$$"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
62 (umask 077 && mkdir "$HGTMP") || {
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
63 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
64 exit 1
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
65 }
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
66
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
67 TESTDIR="$PWD"
1923
7d83a351a936 fix testsuite for freebsd and one timingissue
Peter van Dijk <peter@dataloss.nl>
parents: 1558
diff changeset
68 export TESTDIR
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
69 INST="$HGTMP/install"
1558
651690fe6be3 fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents: 1308
diff changeset
70 PYTHONDIR="$INST/lib/python"
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
71 cd ..
1558
651690fe6be3 fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents: 1308
diff changeset
72 if ${PYTHON-python} setup.py install --home="$INST" \
651690fe6be3 fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents: 1308
diff changeset
73 --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
74 then
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
75 rm tests/install.err
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
76 else
398
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
77 cat tests/install.err
835
9de3535caae8 Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 833
diff changeset
78 exit 1
398
7ed217cfae9e Quiet successful test install in run-tests
mpm@selenic.com
parents: 397
diff changeset
79 fi
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
80 cd "$TESTDIR"
397
e5683db23ec4 From: Andrew Thompson <andrewkt@aktzero.com>
mpm@selenic.com
parents: 382
diff changeset
81
2068
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
82 BINDIR="$INST/bin"; export BINDIR
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
83 if [ -n "$TEST_COVERAGE" ]; then
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
84 COVERAGE_FILE="$TESTDIR/.coverage"; export COVERAGE_FILE
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
85 rm -f "$COVERAGE_FILE"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
86 mv "$BINDIR/hg" "$BINDIR/hg.py"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
87 {
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
88 echo '#!/bin/sh'
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
89 echo "exec \"${PYTHON-python}\" \"$TESTDIR/coverage.py\"" \
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
90 "-x \"$BINDIR/hg.py\" \"\$@\""
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
91 } > "$BINDIR/hg"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
92 chmod 700 "$BINDIR/hg"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
93 fi
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
94
1878
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
95 PATH="$BINDIR:$PATH"; export PATH
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
96 if [ -n "$PYTHON" ]; then
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
97 {
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
98 echo "#!/bin/sh"
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
99 echo "exec \"$PYTHON"'" "$@"'
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
100 } > "$BINDIR/python"
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
101 chmod 755 "$BINDIR/python"
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
102 fi
a5c46cff620f Make #!/usr/bin/env python in test-bdiff run the specified python version.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1558
diff changeset
103
1558
651690fe6be3 fix run-tests' PYTHONPATH
Robin Farine <robin.farine@terminus.org>
parents: 1308
diff changeset
104 PYTHONPATH="$PYTHONDIR"; export PYTHONPATH
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
105
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
106 run_one() {
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
107 rm -f "$1.err"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
108
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
109 mkdir "$HGTMP/$1"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
110 cd "$HGTMP/$1"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
111 fail=0
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
112 HOME="$HGTMP/$1"; export HOME
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
113 OUT="$HGTMP/$1.out"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
114 OUTOK="$TESTDIR/$1.out"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
115 ERR="$TESTDIR/$1.err"
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
116
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
117 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
118 : no error
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
119 else
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
120 echo "$1 failed with error code $?"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
121 fail=1
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
122 fi
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
123
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
124 if [ -s "$OUT" -a ! -s "$OUTOK" ] ; then
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
125 cp "$OUT" "$ERR"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
126 echo
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
127 echo "$1 generated unexpected output:"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
128 cat "$ERR"
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
129 fail=1
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
130 elif [ -r "$OUTOK" ]; then
2059
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
131 if diff $DIFFOPTS "$OUTOK" "$OUT" > /dev/null; then
803
3d47e7fc33a3 Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 802
diff changeset
132 : no differences
3d47e7fc33a3 Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 802
diff changeset
133 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
134 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
135 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
136 echo "$1 output changed:"
2059
a4c271765415 run-tests: Use appropriate (that is: none) diff options on HP-UX.
Sascha Wilde <wilde@sha-bang.de>
parents: 2023
diff changeset
137 diff $DIFFOPTS "$OUTOK" "$ERR" || true
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
138 fail=1
803
3d47e7fc33a3 Use tabs instead of spaces where apropriate.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 802
diff changeset
139 fi
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
140 fi
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
141
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
142 cd "$TESTDIR"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
143 rm -f "$HGTMP/$1.out"
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
144 rm -rf "$HGTMP/$1"
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
145 return $fail
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
146 }
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
147
1308
2073e5a71008 Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1279
diff changeset
148 # 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
149 # stuff from coreutils (cat, rm, etc) are not tested
1949
d2c2e77826c0 tests: add bunzip2 to prerequisite list
Soh Tk-r28629 <tksoh@freescale.com>
parents: 1932
diff changeset
150 prereqs="python merge diff grep unzip gunzip bunzip2 sed"
1279
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
151 missing=''
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
152 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
153 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
154 : prereq exists
1308
2073e5a71008 Cleanup of tabs and trailing spaces.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1279
diff changeset
155 else
1279
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
156 missing="$pre $missing"
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
157 fi
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
158 done
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
159
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
160 if [ "$missing" != '' ] ; then
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
161 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
162 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
163 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
164 echo " $pre"
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
165 done
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
166 exit 1
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
167 fi
8ab1c07d4e0b Add checks for programs which are required for the test suite to run.
eric@localhost.localdomain
parents: 925
diff changeset
168
804
19388dcbac49 Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 803
diff changeset
169 TESTS="$*"
798
c28f9feb7c2e Make tests work on Solaris:
Thomas Arendsen Hein <thomas@intevation.de>
parents: 793
diff changeset
170 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
171 TESTS=`ls test-* | grep -v "[.~]"`
362
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
172 fi
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
173
410373162036 run-tests: run tests given on the command line
mpm@selenic.com
parents: 350
diff changeset
174 for f in $TESTS ; do
1952
f4df34b6987f tests: fix portability issue for echo -n
TK Soh <teekaysoh@yahoo.com>
parents: 1951
diff changeset
175 $ECHO_N ".${NNL}"
804
19388dcbac49 Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 803
diff changeset
176 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
177 tests=`expr $tests + 1`
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
178 done
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
179
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
180 echo
804
19388dcbac49 Incorporated most of Aron Griffis suggestions for sh compatibility.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 803
diff changeset
181 echo "Ran $tests tests, $failed failed."
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
182
2068
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
183 if [ -n "$TEST_COVERAGE" ]; then
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
184 unset PYTHONPATH
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
185 $ECHO_N "$BINDIR,$TESTDIR,$HGTMP/test-," > "$HGTMP/omit"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
186 if [ -z "$COVERAGE_STDLIB" ]; then
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
187 "${PYTHON-python}" -c 'import sys; print ",".join(sys.path)' \
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
188 >> "$HGTMP/omit"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
189 fi
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
190 cd "$PYTHONDIR"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
191 "${PYTHON-python}" "$TESTDIR/coverage.py" -r --omit="`cat \"$HGTMP/omit\"`"
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
192 fi
4a49daa3a40c let run-tests run optional code coverage tests.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2023
diff changeset
193
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
194 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
195 exit 1
331
55f63f3b6a54 Add a simple testing framework
mpm@selenic.com
parents:
diff changeset
196 fi
835
9de3535caae8 Cleaned up trap handling in run-tests, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 833
diff changeset
197 exit 0