From f7cc7d8d05f114b98467b55b69cdceea30894614 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Sun, 28 Aug 2011 16:19:55 +0530 Subject: [PATCH] Bug #835952: pep8 failures do not cause the tests to fail Add set -eu to run_tests.sh. This will cause it to fail whenever anything goes wrong, which is exactly what we want in a test script. To do this, I had to remove the use of the "let" keyword, which has a bizarre exit status in bash. I also removed the "|| exit" after run_tests, which means that this script will now exit with status 1, not status 0, if run_tests fails. --- run_tests.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/run_tests.sh b/run_tests.sh index 871332b4..c1fda4cf 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -eu + function usage { echo "Usage: $0 [OPTION]..." echo "Run Nova's test suite(s)" @@ -24,13 +26,13 @@ function usage { function process_option { case "$1" in -h|--help) usage;; - -V|--virtual-env) let always_venv=1; let never_venv=0;; - -N|--no-virtual-env) let always_venv=0; let never_venv=1;; - -r|--recreate-db) let recreate_db=1;; - -n|--no-recreate-db) let recreate_db=0;; - -f|--force) let force=1;; - -p|--pep8) let just_pep8=1;; - -c|--coverage) let coverage=1;; + -V|--virtual-env) always_venv=1; never_venv=0;; + -N|--no-virtual-env) always_venv=0; never_venv=1;; + -r|--recreate-db) recreate_db=1;; + -n|--no-recreate-db) recreate_db=0;; + -f|--force) force=1;; + -p|--pep8) just_pep8=1;; + -c|--coverage) coverage=1;; -*) noseopts="$noseopts $1";; *) noseargs="$noseargs $1" esac @@ -130,7 +132,7 @@ if [ $recreate_db -eq 1 ]; then rm -f tests.sqlite fi -run_tests || exit +run_tests # NOTE(sirp): we only want to run pep8 when we're running the full-test suite, # not when we're running tests individually. To handle this, we need to