##// END OF EJS Templates
let run-tests run optional code coverage tests....
Vadim Gelfer -
r2068:4a49daa3 default
parent child Browse files
Show More
@@ -8,6 +8,7 b' syntax: glob'
8 8 *.pyc
9 9 *.swp
10 10 *.prof
11 tests/.coverage*
11 12 tests/*.err
12 13 build
13 14 dist
@@ -1,4 +1,9 b''
1 1 #!/bin/sh -e
2 #
3 # environment variables:
4 #
5 # TEST_COVERAGE - set non-empty if you want to print test coverage report
6 # COVERAGE_STDLIB - set non-empty to report coverage of standard library
2 7
3 8 LANG="C"; export LANG
4 9 LC_CTYPE="C"; export LC_CTYPE
@@ -64,7 +69,19 b' else'
64 69 fi
65 70 cd "$TESTDIR"
66 71
67 BINDIR="$INST/bin"
72 BINDIR="$INST/bin"; export BINDIR
73 if [ -n "$TEST_COVERAGE" ]; then
74 COVERAGE_FILE="$TESTDIR/.coverage"; export COVERAGE_FILE
75 rm -f "$COVERAGE_FILE"
76 mv "$BINDIR/hg" "$BINDIR/hg.py"
77 {
78 echo '#!/bin/sh'
79 echo "exec \"${PYTHON-python}\" \"$TESTDIR/coverage.py\"" \
80 "-x \"$BINDIR/hg.py\" \"\$@\""
81 } > "$BINDIR/hg"
82 chmod 700 "$BINDIR/hg"
83 fi
84
68 85 PATH="$BINDIR:$PATH"; export PATH
69 86 if [ -n "$PYTHON" ]; then
70 87 {
@@ -153,6 +170,17 b' done'
153 170 echo
154 171 echo "Ran $tests tests, $failed failed."
155 172
173 if [ -n "$TEST_COVERAGE" ]; then
174 unset PYTHONPATH
175 $ECHO_N "$BINDIR,$TESTDIR,$HGTMP/test-," > "$HGTMP/omit"
176 if [ -z "$COVERAGE_STDLIB" ]; then
177 "${PYTHON-python}" -c 'import sys; print ",".join(sys.path)' \
178 >> "$HGTMP/omit"
179 fi
180 cd "$PYTHONDIR"
181 "${PYTHON-python}" "$TESTDIR/coverage.py" -r --omit="`cat \"$HGTMP/omit\"`"
182 fi
183
156 184 if [ $failed -gt 0 ] ; then
157 185 exit 1
158 186 fi
General Comments 0
You need to be logged in to leave comments. Login now