blob: 472b0ea4afc41cfd17397f8a23874ddbfdb6b9e6 [file] [log] [blame]
Sean Dagueaecd1892014-11-19 15:19:51 -05001#!/usr/bin/env bash
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations
13# under the License.
14
15
16TOP=$(cd $(dirname "$0")/.. && pwd)
17
18export TOP_DIR=$TOP
19
Sean Dague365421b2015-02-06 15:27:43 -050020# we don't actually care about the HOST_IP
21HOST_IP="don't care"
Sean Dagueaecd1892014-11-19 15:19:51 -050022# Import common functions
23source $TOP/functions
24source $TOP/stackrc
25source $TOP/lib/tls
26for i in $TOP/lib/*; do
27 if [[ -f $i ]]; then
28 source $i
29 fi
30done
31
Joshua Harlowee9064b2015-02-19 15:06:23 -080032ALL_LIBS="python-novaclient oslo.config pbr oslo.context python-troveclient"
33ALL_LIBS+=" python-keystoneclient taskflow oslo.middleware pycadf"
34ALL_LIBS+=" python-glanceclient python-ironicclient tempest-lib"
35ALL_LIBS+=" oslo.messaging oslo.log cliff python-heatclient stevedore"
36ALL_LIBS+=" python-cinderclient glance_store oslo.concurrency oslo.db"
37ALL_LIBS+=" oslo.vmware keystonemiddleware oslo.serialization"
38ALL_LIBS+=" python-saharaclient django_openstack_auth"
39ALL_LIBS+=" python-openstackclient oslo.rootwrap oslo.i18n"
40ALL_LIBS+=" python-ceilometerclient oslo.utils python-swiftclient"
41ALL_LIBS+=" python-neutronclient tooz ceilometermiddleware oslo.policy"
42ALL_LIBS+=" debtcollector"
Sean Dagueaecd1892014-11-19 15:19:51 -050043
44# Generate the above list with
45# echo ${!GITREPO[@]}
46
47function check_exists {
48 local thing=$1
49 local hash=$2
50 local key=$3
51 if [[ ! -z "$VERBOSE" ]]; then
52 echo "Checking for $hash[$key]"
53 fi
54 if [[ -z $thing ]]; then
55 echo "$hash[$key] does not exit!"
56 exit 1
57 else
58 if [[ ! -z "$VERBOSE" ]]; then
59 echo "$hash[$key] => $thing"
60 fi
61 fi
62}
63
64function test_all_libs_upto_date {
65 # this is all the magics
66 local found_libs=${!GITREPO[@]}
67 declare -A all_libs
68 for lib in $ALL_LIBS; do
69 all_libs[$lib]=1
70 done
71
72 for lib in $found_libs; do
73 if [[ -z ${all_libs[$lib]} ]]; then
74 echo "Library '$lib' not listed in unit tests, please add to ALL_LIBS"
75 exit 1
76 fi
77
78 done
79 echo "test_all_libs_upto_date PASSED"
80}
81
82function test_libs_exist {
83 local lib=""
84 for lib in $ALL_LIBS; do
85 check_exists "${GITREPO[$lib]}" "GITREPO" "$lib"
86 check_exists "${GITBRANCH[$lib]}" "GITBRANCH" "$lib"
87 check_exists "${GITDIR[$lib]}" "GITDIR" "$lib"
88 done
89
90 echo "test_libs_exist PASSED"
91}
92
93function test_branch_master {
94 for lib in $ALL_LIBS; do
95 if [[ ${GITBRANCH[$lib]} != "master" ]]; then
96 echo "GITBRANCH for $lib not master (${GITBRANCH[$lib]})"
97 exit 1
98 fi
99 done
100
101 echo "test_branch_master PASSED"
102}
103
104set -o errexit
105
106test_libs_exist
107test_branch_master
108test_all_libs_upto_date