summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-25 20:47:50 +0000
committerGerrit Code Review <review@openstack.org>2015-02-25 20:47:50 +0000
commitdc19b11770d580c6bf7da76d65695cd91b6f9ec2 (patch)
tree9cd5adcfb93c2c5dc7e767a7e13a2d2028063734
parent08ee0a0eefb2caff1acb77edec629a7740b1df94 (diff)
parentaa440cc319e8226e39e636726eb97506c70242cb (diff)
downloadglance_store-dc19b11770d580c6bf7da76d65695cd91b6f9ec2.tar.gz
Merge "Add coverage report to run_test.sh"
-rw-r--r--.gitignore1
-rwxr-xr-xrun_tests.sh24
2 files changed, 23 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index ad4e9b8..04faeaa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,4 @@ var/*
ChangeLog
AUTHORS
subunit.log
+covhtml/
diff --git a/run_tests.sh b/run_tests.sh
index 6506df0..b77b23b 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -13,6 +13,7 @@ function usage {
echo " -u, --update Update the virtual environment with any newer package versions"
echo " -p, --pep8 Just run PEP8 and HACKING compliance check"
echo " -P, --no-pep8 Don't run static code checks"
+ echo " -c, --coverage Generate coverage report"
echo " -d, --debug Run tests with testtools instead of testr. This allows you to use the debugger."
echo " -h, --help Print this usage message"
echo " --virtual-env-path <path> Location of the virtualenv directory"
@@ -42,6 +43,7 @@ function process_options {
-u|--update) update=1;;
-p|--pep8) just_pep8=1;;
-P|--no-pep8) no_pep8=1;;
+ -c|--coverage) coverage=1;;
-d|--debug) debug=1;;
--virtual-env-path)
(( i++ ))
@@ -80,6 +82,7 @@ testropts=
wrapper=""
just_pep8=0
no_pep8=0
+coverage=0
debug=0
update=0
concurrency=0
@@ -112,13 +115,17 @@ function run_tests {
fi
${wrapper} python -m testtools.run $testropts $testrargs
- # Short circuit because all of the testr stuff
+ # Short circuit because all of the testr and coverage stuff
# below does not make sense when running testtools.run for
# debugging purposes.
return $?
fi
- TESTRTESTS="$TESTRTESTS"
+ if [ $coverage -eq 1 ]; then
+ TESTRTESTS="$TESTRTESTS --coverage"
+ else
+ TESTRTESTS="$TESTRTESTS"
+ fi
# Just run the test suites in current environment
set +e
@@ -142,6 +149,14 @@ function run_tests {
copy_subunit_log
+ if [ $coverage -eq 1 ]; then
+ echo "Generating HTML coverage report in covhtml/"
+ # Don't compute coverage for common code, which is tested elsewhere
+ ${wrapper} coverage combine
+ ${wrapper} coverage html --include='glance_store/*' --omit='glance_store/openstack/common/*' -d covhtml -i
+ ${wrapper} coverage report --include='glance_store/*' --omit='glance_store/openstack/common/*' -i
+ fi
+
return $RESULT
}
@@ -196,6 +211,11 @@ then
fi
fi
+# Delete old coverage data from previous runs
+if [ $coverage -eq 1 ]; then
+ ${wrapper} coverage erase
+fi
+
if [ $just_pep8 -eq 1 ]; then
run_pep8
exit