Browse code

Fix run_tests to not mask bash8 errors

The addition of the crazy-refs check masked the bash8 exit code. So add
the same pass/fail handling from exercise.sh to provide a neat summary at
the end of the run.

Change-Id: I169eb90c619a114cf8584bee70b7dcda67769dc5

Dean Troyer authored on 2014/03/22 01:48:01
Showing 1 changed files
... ...
@@ -15,6 +15,23 @@
15 15
 #
16 16
 # this runs a series of unit tests for devstack to ensure it's functioning
17 17
 
18
+PASSES=""
19
+FAILURES=""
20
+
21
+# Check the return code and add the test to PASSES or FAILURES as appropriate
22
+# pass_fail <result> <expected> <name>
23
+function pass_fail {
24
+    local result=$1
25
+    local expected=$2
26
+    local test_name=$3
27
+
28
+    if [[ $result -ne $expected ]]; then
29
+        FAILURES="$FAILURES $test_name"
30
+    else
31
+        PASSES="$PASSES $test_name"
32
+    fi
33
+}
34
+
18 35
 if [[ -n $@ ]]; then
19 36
     FILES=$@
20 37
 else
... ...
@@ -27,6 +44,7 @@ fi
27 27
 echo "Running bash8..."
28 28
 
29 29
 ./tools/bash8.py -v $FILES
30
+pass_fail $? 0 bash8
30 31
 
31 32
 
32 33
 # Test that no one is trying to land crazy refs as branches
... ...
@@ -35,8 +53,21 @@ echo "Ensuring we don't have crazy refs"
35 35
 
36 36
 REFS=`grep BRANCH stackrc | grep -v -- '-master'`
37 37
 rc=$?
38
+pass_fail $rc 1 crazy-refs
38 39
 if [[ $rc -eq 0 ]]; then
39 40
     echo "Branch defaults must be master. Found:"
40 41
     echo $REFS
42
+fi
43
+
44
+echo "====================================================================="
45
+for script in $PASSES; do
46
+    echo PASS $script
47
+done
48
+for script in $FAILURES; do
49
+    echo FAILED $script
50
+done
51
+echo "====================================================================="
52
+
53
+if [[ -n "$FAILURES" ]]; then
41 54
     exit 1
42 55
 fi