blob: e359caf98aea7fb92dcceba147d24e53bee85b9a [file] [log] [blame]
Justin Shepherd0d9bbd12011-08-11 12:57:44 -05001#!/bin/bash
2
3function usage {
Jay Pipesf38eaac2012-06-21 13:37:35 -04004 echo "Usage: $0 [OPTION]..."
5 echo "Run Tempest test suite"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -05006 echo ""
Jay Pipesf38eaac2012-06-21 13:37:35 -04007 echo " -s, --smoke Only run smoke tests"
Jay Pipes051075a2012-04-28 17:39:37 -04008 echo " -w, --whitebox Only run whitebox tests"
Jay Pipesf38eaac2012-06-21 13:37:35 -04009 echo " -p, --pep8 Just run pep8"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050010 echo " -h, --help Print this usage message"
Jay Pipesf38eaac2012-06-21 13:37:35 -040011 echo " -d. --debug Debug this script -- set -o xtrace"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050012 exit
13}
14
15function process_option {
16 case "$1" in
17 -h|--help) usage;;
Jay Pipesf38eaac2012-06-21 13:37:35 -040018 -d|--debug) set -o xtrace;;
19 -p|--pep8) let just_pep8=1;;
20 -s|--smoke) noseargs="$noseargs --attr=type=smoke";;
Jay Pipes051075a2012-04-28 17:39:37 -040021 -w|--whitebox) noseargs="$noseargs --attr=type=whitebox";;
Jay Pipesf38eaac2012-06-21 13:37:35 -040022 *) noseargs="$noseargs $1"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050023 esac
24}
25
Sean Dague422af972012-11-16 07:30:43 -050026noseargs=""
Jay Pipesf38eaac2012-06-21 13:37:35 -040027just_pep8=0
28
29export NOSE_WITH_OPENSTACK=1
30export NOSE_OPENSTACK_COLOR=1
31export NOSE_OPENSTACK_RED=15.00
32export NOSE_OPENSTACK_YELLOW=3.00
33export NOSE_OPENSTACK_SHOW_ELAPSED=1
34export NOSE_OPENSTACK_STDOUT=1
35
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050036for arg in "$@"; do
37 process_option $arg
38done
39
Sean Dague422af972012-11-16 07:30:43 -050040
41# only add tempest default if we don't specify a test
42if [[ "x$noseargs" =~ "tempest" ]]; then
43 noseargs="$noseargs"
44else
45 noseargs="$noseargs tempest"
46fi
47
48
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050049function run_tests {
Jay Pipesf38eaac2012-06-21 13:37:35 -040050 $NOSETESTS
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050051}
52
Jay Pipesf38eaac2012-06-21 13:37:35 -040053function run_pep8 {
54 echo "Running pep8 ..."
Sean Dague24e0f7f2012-11-16 10:07:28 -050055 PEP8_EXCLUDE="etc,include,tools,*venv"
Jay Pipesf38eaac2012-06-21 13:37:35 -040056 PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat"
57 PEP8_INCLUDE="."
58 pep8 $PEP8_OPTIONS $PEP8_INCLUDE
59}
60
61NOSETESTS="nosetests $noseargs"
62
63if [ $just_pep8 -eq 1 ]; then
64 run_pep8
65 exit
66fi
67
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050068run_tests || exit
Jay Pipesf38eaac2012-06-21 13:37:35 -040069
70if [ -z "$noseargs" ]; then
71 run_pep8
72fi