Attila Fazekas | 5abb253 | 2012-12-04 11:30:49 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | function usage { |
| 4 | echo "Usage: $0 [OPTION]..." |
| 5 | echo "Run Tempest test suite" |
| 6 | echo "" |
| 7 | echo " -s, --smoke Only run smoke tests" |
| 8 | echo " -w, --whitebox Only run whitebox tests" |
| 9 | echo " -h, --help Print this usage message" |
| 10 | echo " -d. --debug Debug this script -- set -o xtrace" |
| 11 | exit |
| 12 | } |
| 13 | |
| 14 | function process_option { |
| 15 | case "$1" in |
| 16 | -h|--help) usage;; |
| 17 | -d|--debug) set -o xtrace;; |
| 18 | -s|--smoke) noseargs="$noseargs --attr=type=smoke";; |
| 19 | -w|--whitebox) noseargs="$noseargs --attr=type=whitebox";; |
| 20 | *) noseargs="$noseargs $1" |
| 21 | esac |
| 22 | } |
| 23 | |
| 24 | noseargs="" |
| 25 | |
| 26 | export NOSE_WITH_OPENSTACK=1 |
| 27 | export NOSE_OPENSTACK_COLOR=1 |
| 28 | export NOSE_OPENSTACK_RED=15.00 |
| 29 | export NOSE_OPENSTACK_YELLOW=3.00 |
| 30 | export NOSE_OPENSTACK_SHOW_ELAPSED=1 |
| 31 | export NOSE_OPENSTACK_STDOUT=1 |
| 32 | |
| 33 | for arg in "$@"; do |
| 34 | process_option $arg |
| 35 | done |
| 36 | |
| 37 | |
| 38 | # only add tempest default if we don't specify a test |
| 39 | if [[ "x$noseargs" =~ "tempest" ]]; then |
| 40 | noseargs="$noseargs" |
| 41 | else |
| 42 | noseargs="$noseargs tempest" |
| 43 | fi |
| 44 | |
| 45 | |
| 46 | function run_tests { |
| 47 | $NOSETESTS |
| 48 | } |
| 49 | |
| 50 | NOSETESTS="nosetests $noseargs" |
| 51 | |
| 52 | run_tests || exit |