9726e2b4ac6fa4efa86161c2fa76cee9ce47c805
[yardstick.git] / docker / exec_tests.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 set -e
12
13 : ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'}
14 : ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'}
15 : ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec
16
17 : ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'}
18 : ${RELENG_REPO_DIR:='/home/opnfv/repos/releng'}
19 # TEMP HACK to freeze releng version to workaround fetch_os_creds.sh problem
20 : ${RELENG_BRANCH:='abbf19f'} # branch, tag, sha1 or refspec
21
22 git_checkout()
23 {
24     if git cat-file -e $1^{commit} 2>/dev/null; then
25         # branch, tag or sha1 object
26         git checkout $1 && git pull
27     else
28         # refspec / changeset
29         git fetch --tags --progress $2 $1
30         git checkout FETCH_HEAD
31     fi
32 }
33
34 echo
35 echo "INFO: Updating releng -> $RELENG_BRANCH"
36 if [ ! -d $RELENG_REPO_DIR ]; then
37     git clone $RELENG_REPO $RELENG_REPO_DIR
38 fi
39 cd $RELENG_REPO_DIR
40 git checkout master
41 git_checkout $RELENG_BRANCH $RELENG_REPO
42
43 echo
44 echo "INFO: Updating yardstick -> $YARDSTICK_BRANCH"
45 if [ ! -d $YARDSTICK_REPO_DIR ]; then
46     git clone $YARDSTICK_REPO $YARDSTICK_REPO_DIR
47 fi
48 cd $YARDSTICK_REPO_DIR
49 git_checkout $YARDSTICK_BRANCH $YARDSTICK_REPO
50
51 # setup the environment
52 source $YARDSTICK_REPO_DIR/tests/ci/prepare_env.sh
53
54 # execute tests
55 $YARDSTICK_REPO_DIR/tests/ci/yardstick-verify $@