blob: 680f79e62f24ca26603fecb907ad5a12c6f45144 [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
Jay Pipesf38eaac2012-06-21 13:37:35 -040026noseargs="tempest"
27just_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
40function run_tests {
Jay Pipesf38eaac2012-06-21 13:37:35 -040041 $NOSETESTS
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050042}
43
Jay Pipesf38eaac2012-06-21 13:37:35 -040044function run_pep8 {
45 echo "Running pep8 ..."
David Kranz1301f8d2012-10-22 17:03:47 -040046 PEP8_EXCLUDE="etc,include,tools"
Jay Pipesf38eaac2012-06-21 13:37:35 -040047 PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat"
48 PEP8_INCLUDE="."
49 pep8 $PEP8_OPTIONS $PEP8_INCLUDE
50}
51
52NOSETESTS="nosetests $noseargs"
53
54if [ $just_pep8 -eq 1 ]; then
55 run_pep8
56 exit
57fi
58
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050059run_tests || exit
Jay Pipesf38eaac2012-06-21 13:37:35 -040060
61if [ -z "$noseargs" ]; then
62 run_pep8
63fi