Cyclictest invokation script
[kvmfornfv.git] / tests / update_yardstick.sh
1 #!/bin/bash
2 ##############################################################################
3 ## Copyright (c) 2015 Intel Corp.
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 usage () {
12         echo "update_yardstick.sh container_id rpmdir imagedir"
13         exit 1
14 }
15
16 if [ $# -ne 3 ] || [ ! -d $2 ] || [ ! -d $3 ]
17 then
18     usage
19 fi
20
21 DBASE_DIR=/opt
22
23 ROOTDIR=$(cd $(dirname "$0")/.. && pwd)
24 ENVDIR=${ROOTDIR}/ci/envs/
25
26 CID=$1
27 RPMDIR=$2
28 IMGDIR=$3
29
30 docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/scripts/"
31 docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/rpm/"
32 docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/image/"
33
34 copyfile () {
35     docker cp $1 "${CID}:${DBASE_DIR}/$2"
36     if [[ -z $? ]]
37     then
38         echo "Failed to copy $2"
39         exit 1
40     fi
41 }
42
43 # Copy the environment setup scripts to the docker image
44 copyfile ${ENVDIR}/host-setup0.sh 'scripts/'
45 copyfile ${ENVDIR}/host-setup1.sh 'scripts/'
46 copyfile ${ENVDIR}/host-config 'scripts/'
47 copyfile ${ENVDIR}/guest-setup0.sh 'scripts/'
48 copyfile ${ENVDIR}/guest-setup1.sh 'scripts/'
49 copyfile ${ENVDIR}/host-run-qemu.sh 'scripts/'
50 copyfile ${ENVDIR}/kvm4nfv_key 'yardstick_key'
51
52 copyfile "${ROOTDIR}/tests/testexec.sh" 'testexec.sh'
53
54 # Copy the test yaml definition to the docker image
55 copyfile "${ROOTDIR}/tests/pod.yaml" 'pod.yaml'
56 copyfile "${IMGDIR}/guest.img" 'image/'
57
58 docker cp "${ROOTDIR}/tests/cyclictest-node-context.yaml"       ${CID}:${DBASE_DIR}
59
60 # Copy the rpms
61 for f in ${RPMDIR}/*.rpm
62 do
63         docker cp $f  ${CID}:${DBASE_DIR}/rpm/
64 done
65
66 # If we have any yardstick patch for workaround, copy it
67 if [ -e "${ROOTDIR}/tests/yardstick.patch" ]
68 then
69         docker cp ${ROOTDIR}/tests/yardstick.patch ${CID}:${DBASE_DIR}/
70 fi