diff options
| author | jaypipes@gmail.com <> | 2010-09-28 14:48:03 -0400 |
|---|---|---|
| committer | jaypipes@gmail.com <> | 2010-09-28 14:48:03 -0400 |
| commit | 7c8c2f57c752cd8681eef073349f9bdcaa95c868 (patch) | |
| tree | f63ee0ef02838bf8ca54d887efa88147eae3bb09 | |
| parent | fa112f5aec624df7d6fc10584295a38bf440b28c (diff) | |
| download | nova-7c8c2f57c752cd8681eef073349f9bdcaa95c868.tar.gz nova-7c8c2f57c752cd8681eef073349f9bdcaa95c868.tar.xz nova-7c8c2f57c752cd8681eef073349f9bdcaa95c868.zip | |
Adds --force option to run_tests.sh to clear virtualenv. Useful when dependencies change
| -rwxr-xr-x | run_tests.sh | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/run_tests.sh b/run_tests.sh index 6ea40d95e..ec727d094 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -6,6 +6,7 @@ function usage { echo "" echo " -V, --virtual-env Always use virtualenv. Install automatically if not present" echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment" + echo " -f, --force Force a clean re-build of the virtual environment. Useful when dependencies have been added." echo " -h, --help Print this usage message" echo "" echo "Note: with no options specified, the script will try to run the tests in a virtual environment," @@ -14,20 +15,12 @@ function usage { exit } -function process_options { - array=$1 - elements=${#array[@]} - for (( x=0;x<$elements;x++)); do - process_option ${array[${x}]} - done -} - function process_option { - option=$1 - case $option in + case "$1" in -h|--help) usage;; -V|--virtual-env) let always_venv=1; let never_venv=0;; -N|--no-virtual-env) let always_venv=0; let never_venv=1;; + -f|--force) let force=1;; esac } @@ -35,9 +28,11 @@ venv=.nova-venv with_venv=tools/with_venv.sh always_venv=0 never_venv=0 -options=("$@") +force=0 -process_options $options +for arg in "$@"; do + process_option $arg +done if [ $never_venv -eq 1 ]; then # Just run the test suites in current environment @@ -45,6 +40,12 @@ if [ $never_venv -eq 1 ]; then exit fi +# Remove the virtual environment if --force used +if [ $force -eq 1 ]; then + echo "Cleaning virtualenv..." + rm -rf ${venv} +fi + if [ -e ${venv} ]; then ${with_venv} python run_tests.py $@ else |
