From 7f9d9b9d5f5621f00ba1a425307de0c242fc3453 Mon Sep 17 00:00:00 2001 From: Keith Holman Date: Fri, 30 May 2014 11:40:39 -0400 Subject: [PATCH] horizon: fix test script to not require coverage tool Horizon provides a run_tests.sh script for testing the functionality of the installation of the product in the target environment. The script contains a "-c" option to allow code coverage testing using the "coverage" tool. However, the script currently still calls the tool even if the option is not given. This fix removes the dependency on the "coverage" command if the "-c" option is not passed to the script. Signed-off-by: Keith Holman --- run_tests.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 5993c81..a297cd9 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -298,8 +298,12 @@ function run_tests_all { if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then export NOSE_HTML_OUT_FILE='horizon_nose_results.html' fi - ${command_wrapper} coverage erase - ${command_wrapper} coverage run -p $root/manage.py test horizon --settings=horizon.test.settings $testopts + if [ $with_coverage -eq 1 ]; then + ${command_wrapper} coverage erase + ${command_wrapper} coverage run -p $root/manage.py test horizon --settings=horizon.test.settings $testopts + else + ${command_wrapper} python $root/manage.py test horizon --settings=horizon.test.settings $testopts + fi # get results of the Horizon tests HORIZON_RESULT=$? @@ -308,7 +312,11 @@ function run_tests_all { if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then export NOSE_HTML_OUT_FILE='dashboard_nose_results.html' fi - ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts + if [ $with_coverage -eq 1 ]; then + ${command_wrapper} coverage run -p $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts + else + ${command_wrapper} python $root/manage.py test openstack_dashboard --settings=openstack_dashboard.test.settings $testopts + fi # get results of the openstack_dashboard tests DASHBOARD_RESULT=$? @@ -317,9 +325,9 @@ function run_tests_all { ${command_wrapper} coverage combine ${command_wrapper} coverage xml -i --omit='/usr*,setup.py,*egg*,.venv/*' ${command_wrapper} coverage html -i --omit='/usr*,setup.py,*egg*,.venv/*' -d reports + # Remove the leftover coverage files from the -p flag earlier. + rm -f .coverage.* fi - # Remove the leftover coverage files from the -p flag earlier. - rm -f .coverage.* if [ $(($HORIZON_RESULT || $DASHBOARD_RESULT)) -eq 0 ]; then echo "Tests completed successfully." -- 1.9.3