blob: 7e96bae7bbe16b46b016933cb16f2e03dc7a926c [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
20# Import common functions
21source $TOP/functions
22source $TOP/stackrc
23source $TOP/lib/tls
24for i in $TOP/lib/*; do
25 if [[ -f $i ]]; then
26 source $i
27 fi
28done
29
Julien Danjouc187b882014-12-09 15:41:55 +010030ALL_LIBS="python-novaclient oslo.config pbr oslo.context python-troveclient python-keystoneclient taskflow oslo.middleware pycadf python-glanceclient python-ironicclient tempest-lib oslo.messaging oslo.log cliff python-heatclient stevedore python-cinderclient glance_store oslo.concurrency oslo.db oslo.vmware keystonemiddleware oslo.serialization python-saharaclient django_openstack_auth python-openstackclient oslo.rootwrap oslo.i18n python-ceilometerclient oslo.utils python-swiftclient python-neutronclient tooz"
Sean Dagueaecd1892014-11-19 15:19:51 -050031
32# Generate the above list with
33# echo ${!GITREPO[@]}
34
35function check_exists {
36 local thing=$1
37 local hash=$2
38 local key=$3
39 if [[ ! -z "$VERBOSE" ]]; then
40 echo "Checking for $hash[$key]"
41 fi
42 if [[ -z $thing ]]; then
43 echo "$hash[$key] does not exit!"
44 exit 1
45 else
46 if [[ ! -z "$VERBOSE" ]]; then
47 echo "$hash[$key] => $thing"
48 fi
49 fi
50}
51
52function test_all_libs_upto_date {
53 # this is all the magics
54 local found_libs=${!GITREPO[@]}
55 declare -A all_libs
56 for lib in $ALL_LIBS; do
57 all_libs[$lib]=1
58 done
59
60 for lib in $found_libs; do
61 if [[ -z ${all_libs[$lib]} ]]; then
62 echo "Library '$lib' not listed in unit tests, please add to ALL_LIBS"
63 exit 1
64 fi
65
66 done
67 echo "test_all_libs_upto_date PASSED"
68}
69
70function test_libs_exist {
71 local lib=""
72 for lib in $ALL_LIBS; do
73 check_exists "${GITREPO[$lib]}" "GITREPO" "$lib"
74 check_exists "${GITBRANCH[$lib]}" "GITBRANCH" "$lib"
75 check_exists "${GITDIR[$lib]}" "GITDIR" "$lib"
76 done
77
78 echo "test_libs_exist PASSED"
79}
80
81function test_branch_master {
82 for lib in $ALL_LIBS; do
83 if [[ ${GITBRANCH[$lib]} != "master" ]]; then
84 echo "GITBRANCH for $lib not master (${GITBRANCH[$lib]})"
85 exit 1
86 fi
87 done
88
89 echo "test_branch_master PASSED"
90}
91
92set -o errexit
93
94test_libs_exist
95test_branch_master
96test_all_libs_upto_date