blob: 30325fe45d6f997a2a100b10fe2398c12db56b06 [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"
8 echo " -p, --pep8 Just run pep8"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -05009 echo " -h, --help Print this usage message"
Jay Pipesf38eaac2012-06-21 13:37:35 -040010 echo " -d. --debug Debug this script -- set -o xtrace"
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050011 exit
12}
13
14function process_option {
15 case "$1" in
16 -h|--help) usage;;
Jay Pipesf38eaac2012-06-21 13:37:35 -040017 -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 Shepherd0d9bbd12011-08-11 12:57:44 -050021 esac
22}
23
Jay Pipesf38eaac2012-06-21 13:37:35 -040024noseargs="tempest"
25just_pep8=0
26
27export NOSE_WITH_OPENSTACK=1
28export NOSE_OPENSTACK_COLOR=1
29export NOSE_OPENSTACK_RED=15.00
30export NOSE_OPENSTACK_YELLOW=3.00
31export NOSE_OPENSTACK_SHOW_ELAPSED=1
32export NOSE_OPENSTACK_STDOUT=1
33
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050034for arg in "$@"; do
35 process_option $arg
36done
37
38function run_tests {
Jay Pipesf38eaac2012-06-21 13:37:35 -040039 $NOSETESTS
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050040}
41
Jay Pipesf38eaac2012-06-21 13:37:35 -040042function 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
50NOSETESTS="nosetests $noseargs"
51
52if [ $just_pep8 -eq 1 ]; then
53 run_pep8
54 exit
55fi
56
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050057run_tests || exit
Jay Pipesf38eaac2012-06-21 13:37:35 -040058
59if [ -z "$noseargs" ]; then
60 run_pep8
61fi