4
echo "Usage: $0 [OPTION]..."
5
echo "Run Glance's test suite(s)"
7
echo " -V, --virtual-env Always use virtualenv. Install automatically if not present"
8
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local environment"
9
echo " -h, --help Print this usage message"
11
echo "Note: with no options specified, the script will try to run the tests in a virtual environment,"
12
echo " If no virtualenv is found, the script will ask if you would like to create one. If you "
13
echo " prefer to run tests NOT in a virtual environment, simply pass the -N option."
17
function process_options {
20
for (( x=0;x<$elements;x++)); do
21
process_option ${array[${x}]}
25
function process_option {
29
-V|--virtual-env) let always_venv=1; let never_venv=0;;
30
-N|--no-virtual-env) let always_venv=0; let never_venv=1;;
35
with_venv=tools/with_venv.sh
40
process_options $options
42
if [ $never_venv -eq 1 ]; then
43
# Just run the test suites in current environment
48
if [ -e ${venv} ]; then
49
${with_venv} nosetests
51
if [ $always_venv -eq 1 ]; then
52
# Automatically install the virtualenv
53
python tools/install_venv.py
55
echo -e "No virtual environment found...create one? (Y/n) \c"
57
if [ "x$use_ve" = "xY" ]; then
58
# Install the virtualenv and run the test suite in it
59
python tools/install_venv.py
65
${with_venv} nosetests