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