blob: 7016a30b6f3000bd255e5ead3861d58ad6153435 [file] [log] [blame]
Attila Fazekas5abb2532012-12-04 11:30:49 +01001#!/usr/bin/env bash
Justin Shepherd0d9bbd12011-08-11 12:57:44 -05002
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 ..."
Matthew Treinish8b372892012-12-07 17:13:16 -050055 srcfiles="`find tempest -type f -name "*.py"`"
56 srcfiles+=" `find tools -type f -name "*.py"`"
57 srcfiles+=" setup.py"
58
59 ignore='--ignore=N4,E121,E122,E125,E126'
60
61 python tools/hacking.py ${ignore} ${srcfiles}
Jay Pipesf38eaac2012-06-21 13:37:35 -040062}
63
64NOSETESTS="nosetests $noseargs"
65
66if [ $just_pep8 -eq 1 ]; then
67 run_pep8
68 exit
69fi
70
Justin Shepherd0d9bbd12011-08-11 12:57:44 -050071run_tests || exit
Jay Pipesf38eaac2012-06-21 13:37:35 -040072
73if [ -z "$noseargs" ]; then
74 run_pep8
75fi