forked from reddit-archive/reddit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoverage.sh
More file actions
executable file
·55 lines (49 loc) · 1.12 KB
/
coverage.sh
File metadata and controls
executable file
·55 lines (49 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
set -e
BASEDIR=$(readlink -f $(dirname $0))
cd $BASEDIR
VERSION=$(git rev-parse HEAD)
COVERDIR="$BASEDIR/build/cover-$VERSION"
function usage() {
echo "Run unit tests and coverage reports on reddit codebase with optional"
echo "http server to the report"
echo
echo "Usage: `basename $0` [options]";
echo
echo " -h show this message"
echo " -p \$PORT run an simple http server on \$PORT to view results"
echo " -v verbose mode (set -x)"
echo
}
while getopts ":vhp:" opt; do
case $opt in
p) PORT="$OPTARG" ;;
v) set -x ;;
h)
usage
exit 0
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
exit 1
;;
esac
done
nosetests \
--with-coverage \
--cover-html \
--cover-html-dir=$COVERDIR \
--cover-erase \
--cover-package=r2
if [ "$PORT" != "" ]; then
echo "Starting http server on :$PORT (^C to exit)"
pushd $COVERDIR
python -m SimpleHTTPServer $PORT || echo "Done."
popd
fi
rm -r $COVERDIR