From 39032c359f01a5e397fce2eb8326b961c9673607 Mon Sep 17 00:00:00 2001 From: Darrell Bishop Date: Wed, 27 Nov 2013 12:07:42 -0500 Subject: [PATCH] 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 --- .unittests | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.unittests b/.unittests index 4b33e00558..ffce146d6b 100755 --- a/.unittests +++ b/.unittests @@ -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