Add HTML reporting for test branch coverage.

When including branch coverage results, also generate HTML reports into
a "cover" subdirectory under the directory in which .unittests resides
(i.e. known location at the top of the swift tree).

Change-Id: I493d74f38755f7bf0d7043052585efb27840b238
This commit is contained in:
Darrell Bishop 2013-11-27 12:07:42 -05:00
parent d8e46eba47
commit 39032c359f

View File

@ -1,12 +1,16 @@
#!/bin/bash
TOP_DIR=$(dirname $(python -c 'import os,sys;print os.path.realpath(sys.argv[1])' $0))
python -c 'from distutils.version import LooseVersion as Ver; import nose, sys; sys.exit(0 if Ver(nose.__version__) >= Ver("1.2.0") else 1)'
if [ $? != 0 ]; then
cover_branches=""
else
cover_branches="--cover-branches"
# Having the HTML reports is REALLY useful for achieving 100% branch
# coverage.
cover_branches="--cover-branches --cover-html --cover-html-dir=$TOP_DIR/cover"
fi
cd $(dirname $0)/test/unit
cd $TOP_DIR/test/unit
nosetests --exe --with-coverage --cover-package swift. --cover-erase $cover_branches $@
rvalue=$?
rm -f .coverage