Fix for bug 877525

We now have a verbose flag (-v) for run_tests.sh if you want ot see all that
crap printed to the screen.  The default behavior is just to print "test nam
.. OK".  Also, we took the code from nova to cat run_tests.log if there is a
error so that if we hit an import error we will see it in the console jenkin
output.

Change-Id: Id8997c658a61691bf9f25b1c01e6a5db0eca428f
This commit is contained in:
Brad Hall 2011-11-05 04:42:16 -07:00
parent a08016ae93
commit 7c29727304
1 changed files with 19 additions and 2 deletions

View File

@ -23,6 +23,7 @@ function process_option {
-N|--no-virtual-env) let always_venv=0; let never_venv=1;;
-f|--force) let force=1;;
-c|--coverage) coverage=1;;
-v|--verbose) verbose=1;;
-*) noseopts="$noseopts $1";;
*) noseargs="$noseargs $1"
esac
@ -36,6 +37,7 @@ force=0
noseargs=
wrapper=""
coverage=0
verbose=0
for arg in "$@"; do
process_option $arg
@ -49,7 +51,22 @@ fi
function run_tests {
# Just run the test suites in current environment
${wrapper} rm -f ./$PLUGIN_DIR/tests.sqlite
${wrapper} $NOSETESTS
if [ $verbose -eq 1 ]; then
${wrapper} $NOSETESTS
else
${wrapper} $NOSETESTS 2> run_tests.log
fi
# If we get some short import error right away, print the error log directly
RESULT=$?
if [ "$RESULT" -ne "0" ];
then
ERRSIZE=`wc -l run_tests.log | awk '{print \$1}'`
if [ $verbose -eq 0 -a "$ERRSIZE" -lt "40" ];
then
cat run_tests.log
fi
fi
return $RESULT
}
NOSETESTS="python ./$PLUGIN_DIR/run_tests.py $noseopts $noseargs"
@ -83,7 +100,7 @@ then
if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
# Install the virtualenv and run the test suite in it
python tools/install_venv.py
wrapper=${with_venv}
wrapper=${with_venv}
fi
fi
fi