latex-writer: Handle class arguments for block-level elements
[docutils.git] / test / coverage.sh
blob1717cb535e989ac46242b38a6b571ac4b47919bc
1 #!/bin/bash
3 # $Id$
4 # Author: Lea Wiemann <LeWiemann@gmail.com>
5 # Copyright: This script has been placed in the public domain.
7 # Usage: ./coverage.sh [project, [module]]
9 set -e
10 # Resolve all symlinks in current path.
11 cd -P .
12 proj="${PWD##*/}"
13 if test "$proj" == test; then
14 cd ..
15 proj="${PWD##*/}"
17 if test "$1"; then
18 proj="$1"
20 module="${2:-alltests.py}"
21 module="${module#test/}"
22 echo "Performing code coverage test for project \"$proj\", test module \"$module\"..."
23 echo
24 echo "Please be patient; coverage tracking slows test execution down by more"
25 echo "than factor 10."
26 echo
27 cd test
28 rm -rf cover
29 mkdir -p cover
30 python -u -m trace --count --coverdir=cover --missing "$module"
31 cd ..
32 echo
33 echo
34 echo Uncovered lines
35 echo ===============
36 echo
38 find "$proj/" -name \*.py | while read i; do
39 i="${i%.py}"
40 test -f test/cover/"${i//\//.}".cover -o "${i##*/}" == Template || echo "${i//\//.}" "`cat "$i.py" | wc -l`"
41 done
42 cd test/cover
43 find . \( -name . -o ! -name "$proj".\* -exec rm {} \; \)
44 for i in *.cover; do
45 sed 's/^>>>>>> \(.*"""\)/ \1/' < "$i" > "${i%.cover}"
46 rm "$i"
47 done
48 for i in *; do echo -n "$i "; grep -c '^>>>>>> ' "$i" || true; done
49 ) | grep -v ' 0$' | sort -nk 2