This adds hacking.py, based on the one in nova, to wrap around pep8 and enforce more stringent checks on tempest. This adds the rules that nova is currently enforcing on incoming commits. The rules that pep8 is ignoring are copied from the pep8 check on jenkins. The HACKING file was also updated to indicate the inclusion of the new rules that are being enforced. Change-Id: I5c85829ee15d4264d8de2d9f0207d9dd3dfbbff2
76 lines
1.6 KiB
Bash
Executable File
76 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
function usage {
|
|
echo "Usage: $0 [OPTION]..."
|
|
echo "Run Tempest test suite"
|
|
echo ""
|
|
echo " -s, --smoke Only run smoke tests"
|
|
echo " -w, --whitebox Only run whitebox tests"
|
|
echo " -p, --pep8 Just run pep8"
|
|
echo " -h, --help Print this usage message"
|
|
echo " -d. --debug Debug this script -- set -o xtrace"
|
|
exit
|
|
}
|
|
|
|
function process_option {
|
|
case "$1" in
|
|
-h|--help) usage;;
|
|
-d|--debug) set -o xtrace;;
|
|
-p|--pep8) let just_pep8=1;;
|
|
-s|--smoke) noseargs="$noseargs --attr=type=smoke";;
|
|
-w|--whitebox) noseargs="$noseargs --attr=type=whitebox";;
|
|
*) noseargs="$noseargs $1"
|
|
esac
|
|
}
|
|
|
|
noseargs=""
|
|
just_pep8=0
|
|
|
|
export NOSE_WITH_OPENSTACK=1
|
|
export NOSE_OPENSTACK_COLOR=1
|
|
export NOSE_OPENSTACK_RED=15.00
|
|
export NOSE_OPENSTACK_YELLOW=3.00
|
|
export NOSE_OPENSTACK_SHOW_ELAPSED=1
|
|
export NOSE_OPENSTACK_STDOUT=1
|
|
|
|
for arg in "$@"; do
|
|
process_option $arg
|
|
done
|
|
|
|
|
|
# only add tempest default if we don't specify a test
|
|
if [[ "x$noseargs" =~ "tempest" ]]; then
|
|
noseargs="$noseargs"
|
|
else
|
|
noseargs="$noseargs tempest"
|
|
fi
|
|
|
|
|
|
function run_tests {
|
|
$NOSETESTS
|
|
}
|
|
|
|
function run_pep8 {
|
|
echo "Running pep8 ..."
|
|
srcfiles="`find tempest -type f -name "*.py"`"
|
|
srcfiles+=" `find tools -type f -name "*.py"`"
|
|
srcfiles+=" setup.py"
|
|
|
|
ignore='--ignore=N4,E121,E122,E125,E126'
|
|
|
|
python tools/hacking.py ${ignore} ${srcfiles}
|
|
}
|
|
|
|
NOSETESTS="nosetests $noseargs"
|
|
|
|
if [ $just_pep8 -eq 1 ]; then
|
|
run_pep8
|
|
exit
|
|
fi
|
|
|
|
run_tests || exit
|
|
|
|
if [ -z "$noseargs" ]; then
|
|
run_pep8
|
|
fi
|