Sean Dague | aecd189 | 2014-11-19 15:19:51 -0500 | [diff] [blame] | 1 | #!/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 | |
| 16 | TOP=$(cd $(dirname "$0")/.. && pwd) |
| 17 | |
| 18 | export TOP_DIR=$TOP |
| 19 | |
Sean Dague | 365421b | 2015-02-06 15:27:43 -0500 | [diff] [blame] | 20 | # we don't actually care about the HOST_IP |
| 21 | HOST_IP="don't care" |
Sean Dague | aecd189 | 2014-11-19 15:19:51 -0500 | [diff] [blame] | 22 | # Import common functions |
| 23 | source $TOP/functions |
| 24 | source $TOP/stackrc |
| 25 | source $TOP/lib/tls |
| 26 | for i in $TOP/lib/*; do |
| 27 | if [[ -f $i ]]; then |
| 28 | source $i |
| 29 | fi |
| 30 | done |
| 31 | |
James E. Blair | 9e220b9 | 2015-03-24 16:32:03 -0700 | [diff] [blame^] | 32 | ALL_LIBS="python-novaclient oslo.config pbr oslo.context" |
Joshua Harlow | ee9064b | 2015-02-19 15:06:23 -0800 | [diff] [blame] | 33 | ALL_LIBS+=" python-keystoneclient taskflow oslo.middleware pycadf" |
| 34 | ALL_LIBS+=" python-glanceclient python-ironicclient tempest-lib" |
| 35 | ALL_LIBS+=" oslo.messaging oslo.log cliff python-heatclient stevedore" |
| 36 | ALL_LIBS+=" python-cinderclient glance_store oslo.concurrency oslo.db" |
Dan Smith | aca8a7f | 2015-03-03 08:50:27 -0800 | [diff] [blame] | 37 | ALL_LIBS+=" oslo.versionedobjects oslo.vmware keystonemiddleware" |
| 38 | ALL_LIBS+=" oslo.serialization python-saharaclient django_openstack_auth" |
Joshua Harlow | ee9064b | 2015-02-19 15:06:23 -0800 | [diff] [blame] | 39 | ALL_LIBS+=" python-openstackclient oslo.rootwrap oslo.i18n" |
| 40 | ALL_LIBS+=" python-ceilometerclient oslo.utils python-swiftclient" |
| 41 | ALL_LIBS+=" python-neutronclient tooz ceilometermiddleware oslo.policy" |
| 42 | ALL_LIBS+=" debtcollector" |
Sean Dague | aecd189 | 2014-11-19 15:19:51 -0500 | [diff] [blame] | 43 | |
| 44 | # Generate the above list with |
| 45 | # echo ${!GITREPO[@]} |
| 46 | |
| 47 | function 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 | |
| 64 | function 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 | |
| 82 | function 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 | |
| 93 | function 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 | |
| 104 | set -o errexit |
| 105 | |
| 106 | test_libs_exist |
| 107 | test_branch_master |
| 108 | test_all_libs_upto_date |