| Dean Troyer | 608bb12 | 2012-01-10 14:43:17 -0600 | [diff] [blame] | 1 | #!/usr/bin/env bash | 
 | 2 | # | 
 | 3 | # build_tempest.sh - Checkout and prepare a Tempest repo | 
 | 4 | #                    (https://github.com/openstack/tempest.git) | 
 | 5 |  | 
 | 6 | function usage { | 
 | 7 |     echo "$0 - Check out and prepare a Tempest repo" | 
 | 8 |     echo "" | 
 | 9 |     echo "Usage: $0" | 
 | 10 |     exit 1 | 
 | 11 | } | 
 | 12 |  | 
 | 13 | if [ "$1" = "-h" ]; then | 
 | 14 |     usage | 
 | 15 | fi | 
 | 16 |  | 
 | 17 | # Clean up any resources that may be in use | 
 | 18 | cleanup() { | 
 | 19 |     set +o errexit | 
 | 20 |  | 
 | 21 |     # Kill ourselves to signal any calling process | 
 | 22 |     trap 2; kill -2 $$ | 
 | 23 | } | 
 | 24 |  | 
 | 25 | trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT | 
 | 26 |  | 
 | 27 | # Keep track of the current directory | 
 | 28 | TOOLS_DIR=$(cd $(dirname "$0") && pwd) | 
| Dean Troyer | 7f9aa71 | 2012-01-31 12:11:56 -0600 | [diff] [blame] | 29 | TOP_DIR=$(cd $TOOLS_DIR/..; pwd) | 
 | 30 |  | 
 | 31 | # Import common functions | 
 | 32 | . $TOP_DIR/functions | 
| Dean Troyer | 608bb12 | 2012-01-10 14:43:17 -0600 | [diff] [blame] | 33 |  | 
 | 34 | # Abort if localrc is not set | 
 | 35 | if [ ! -e $TOP_DIR/localrc ]; then | 
 | 36 |     echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding." | 
 | 37 |     echo "See stack.sh for required passwords." | 
 | 38 |     exit 1 | 
 | 39 | fi | 
 | 40 |  | 
 | 41 | # Source params | 
 | 42 | source ./stackrc | 
 | 43 |  | 
 | 44 | # Where Openstack code lives | 
 | 45 | DEST=${DEST:-/opt/stack} | 
 | 46 |  | 
 | 47 | TEMPEST_DIR=$DEST/tempest | 
 | 48 |  | 
| Dean Troyer | 608bb12 | 2012-01-10 14:43:17 -0600 | [diff] [blame] | 49 | # Install tests and prerequisites | 
| Dean Troyer | 7f9aa71 | 2012-01-31 12:11:56 -0600 | [diff] [blame] | 50 | pip_install `cat $TOP_DIR/files/pips/tempest` | 
| Dean Troyer | 608bb12 | 2012-01-10 14:43:17 -0600 | [diff] [blame] | 51 |  | 
 | 52 | git_clone $TEMPEST_REPO $TEMPEST_DIR $TEMPEST_BRANCH | 
 | 53 |  | 
 | 54 | trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT |