Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | function usage { |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 4 | echo "Usage: $0 [OPTION]..." |
| 5 | echo "Run Tempest test suite" |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 6 | echo "" |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 7 | echo " -s, --smoke Only run smoke tests" |
| 8 | echo " -p, --pep8 Just run pep8" |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 9 | echo " -h, --help Print this usage message" |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 10 | echo " -d. --debug Debug this script -- set -o xtrace" |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 11 | exit |
| 12 | } |
| 13 | |
| 14 | function process_option { |
| 15 | case "$1" in |
| 16 | -h|--help) usage;; |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 17 | -d|--debug) set -o xtrace;; |
| 18 | -p|--pep8) let just_pep8=1;; |
| 19 | -s|--smoke) noseargs="$noseargs --attr=type=smoke";; |
| 20 | *) noseargs="$noseargs $1" |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 21 | esac |
| 22 | } |
| 23 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 24 | noseargs="tempest" |
| 25 | just_pep8=0 |
| 26 | |
| 27 | export NOSE_WITH_OPENSTACK=1 |
| 28 | export NOSE_OPENSTACK_COLOR=1 |
| 29 | export NOSE_OPENSTACK_RED=15.00 |
| 30 | export NOSE_OPENSTACK_YELLOW=3.00 |
| 31 | export NOSE_OPENSTACK_SHOW_ELAPSED=1 |
| 32 | export NOSE_OPENSTACK_STDOUT=1 |
| 33 | |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 34 | for arg in "$@"; do |
| 35 | process_option $arg |
| 36 | done |
| 37 | |
| 38 | function run_tests { |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 39 | $NOSETESTS |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 40 | } |
| 41 | |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 42 | function run_pep8 { |
| 43 | echo "Running pep8 ..." |
| 44 | PEP8_EXCLUDE="kong,etc,include,tools" |
| 45 | PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat" |
| 46 | PEP8_INCLUDE="." |
| 47 | pep8 $PEP8_OPTIONS $PEP8_INCLUDE |
| 48 | } |
| 49 | |
| 50 | NOSETESTS="nosetests $noseargs" |
| 51 | |
| 52 | if [ $just_pep8 -eq 1 ]; then |
| 53 | run_pep8 |
| 54 | exit |
| 55 | fi |
| 56 | |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 57 | run_tests || exit |
Jay Pipes | f38eaac | 2012-06-21 13:37:35 -0400 | [diff] [blame] | 58 | |
| 59 | if [ -z "$noseargs" ]; then |
| 60 | run_pep8 |
| 61 | fi |