swift/.unittests
Darrell Bishop 39032c359f 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
2013-11-27 12:07:42 -05:00

19 lines
619 B
Bash
Executable File

#!/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
# 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 $TOP_DIR/test/unit
nosetests --exe --with-coverage --cover-package swift. --cover-erase $cover_branches $@
rvalue=$?
rm -f .coverage
cd -
exit $rvalue