Browse code

make run_tests.sh run devstack unit tests

run_tests.sh was created as an entry point for bashate. We stopped
using it now that we know how to run bashate directly in the gate.
We lost running an unrelated bashate test when that happened.

Devstack does have unit tests. We don't run them. We should.
Especially when working on things like the LIBS_FROM_GIT which is
sufficiently tricky that we really need to add unit tests to ensure
that we don't break it.

Change-Id: Ife067855569e2eae4c085471d326e8086de37332

Sean Dague authored on 2014/11/18 05:14:49
Showing 2 changed files
... ...
@@ -18,47 +18,18 @@
18 18
 PASSES=""
19 19
 FAILURES=""
20 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
21
+# Test that no one is trying to land crazy refs as branches
27 22
 
28
-    if [[ $result -ne $expected ]]; then
29
-        FAILURES="$FAILURES $test_name"
23
+for testfile in tests/test_*.sh; do
24
+    $testfile
25
+    if [[ $? -eq 0 ]]; then
26
+        PASSES="$PASSES $testfile"
30 27
     else
31
-        PASSES="$PASSES $test_name"
28
+        FAILURES="$FAILURES $testfile"
32 29
     fi
33
-}
34
-
35
-if [[ -n $@ ]]; then
36
-    FILES=$@
37
-else
38
-    LIBS=`find lib -type f | grep -v \.md`
39
-    SCRIPTS=`find . -type f -name \*\.sh`
40
-    EXTRA="functions functions-common stackrc openrc exerciserc eucarc"
41
-    FILES="$SCRIPTS $LIBS $EXTRA"
42
-fi
43
-
44
-echo "Running bash8..."
45
-
46
-tox -ebashate
47
-pass_fail $? 0 bash8
48
-
49
-
50
-# Test that no one is trying to land crazy refs as branches
51
-
52
-echo "Ensuring we don't have crazy refs"
53
-
54
-REFS=`grep BRANCH stackrc | grep -v -- '-master'`
55
-rc=$?
56
-pass_fail $rc 1 crazy-refs
57
-if [[ $rc -eq 0 ]]; then
58
-    echo "Branch defaults must be master. Found:"
59
-    echo $REFS
60
-fi
30
+done
61 31
 
32
+# Summary display now that all is said and done
62 33
 echo "====================================================================="
63 34
 for script in $PASSES; do
64 35
     echo PASS $script
65 36
new file mode 100755
... ...
@@ -0,0 +1,24 @@
0
+#!/bin/bash
1
+#
2
+# Licensed under the Apache License, Version 2.0 (the "License");
3
+# you may not use this file except in compliance with the License.
4
+# You may obtain a copy of the License at
5
+#
6
+#    http://www.apache.org/licenses/LICENSE-2.0
7
+#
8
+# Unless required by applicable law or agreed to in writing, software
9
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
+# License for the specific language governing permissions and limitations
12
+# under the License.
13
+
14
+
15
+echo "Ensuring we don't have crazy refs"
16
+
17
+REFS=`grep BRANCH stackrc | grep -v -- '-master'`
18
+rc=$?
19
+if [[ $rc -eq 0 ]]; then
20
+    echo "Branch defaults must be master. Found:"
21
+    echo $REFS
22
+    exit 1
23
+fi