summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Dugger <donald.d.dugger@intel.com>2016-01-06 21:31:21 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-06 21:31:21 +0000
commit00bbfcd8f77b0379efa999a290b0edd1de7ed07d (patch)
tree497dcddd67b557ee61867282dcf6c18febbb316f
parent094281166bad07b351bda2e16b225f492c959bf3 (diff)
parenta04839a2f102d65aff45f6c4dbce15a35354594c (diff)
Merge topic 'yardstick-integ-v2'
* changes: Cyclictest invokation script Add the yardstick invokation script
-rw-r--r--tests/cyclictest-node-context.yaml50
-rwxr-xr-xtests/cyclictest.sh60
-rwxr-xr-xtests/testexec.sh148
-rwxr-xr-xtests/update_yardstick.sh70
4 files changed, 328 insertions, 0 deletions
diff --git a/tests/cyclictest-node-context.yaml b/tests/cyclictest-node-context.yaml
new file mode 100644
index 000000000..be1219c91
--- /dev/null
+++ b/tests/cyclictest-node-context.yaml
@@ -0,0 +1,50 @@
+---
+# Sample benchmark task config file
+# Measure system high resolution by using Cyclictest
+#
+# For this sample just like running the command below on the test vm and
+# getting latencies info back to the yardstick.
+#
+# sudo bash cyclictest -a 1 -i 1000 -p 99 -l 1000 -t 1 -h 90 -m -n -q
+#
+
+schema: "yardstick:task:0.1"
+
+scenarios:
+-
+ type: Cyclictest
+ options:
+ affinity: 1
+ interval: 1000
+ priority: 99
+ loops: 1000
+ threads: 1
+ histogram: 90
+ host: kvm.LF
+ runner:
+ type: Duration
+ duration: 1
+ interval: 1
+ sla:
+ max_min_latency: 50
+ max_avg_latency: 100
+ max_max_latency: 1000
+ action: monitor
+ setup_options:
+ rpm_dir: "/opt/rpm"
+ script_dir: "/opt/scripts"
+ image_dir: "/opt/image"
+ host_setup_seqs:
+ - "host-setup0.sh"
+ - "reboot"
+ - "host-setup1.sh"
+ - "host-run-qemu.sh"
+ guest_setup_seqs:
+ - "guest-setup0.sh"
+ - "reboot"
+ - "guest-setup1.sh"
+
+context:
+ type: Node
+ name: LF
+ file: /opt/pod.yaml
diff --git a/tests/cyclictest.sh b/tests/cyclictest.sh
new file mode 100755
index 000000000..840adc6fb
--- /dev/null
+++ b/tests/cyclictest.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+##############################################################################
+## Copyright (c) 2015 Intel Corp.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+usage () {
+ echo "Usage: ${0} rpmdir image_dir"
+ exit 1
+}
+
+if [[ $# -ne 2 ]]; then
+ usage
+fi
+
+rpmdir=$1
+imagedir=$2
+
+ROOT_DIR=$(cd $(dirname "$0")/.. && pwd)
+ENVDIR=${ROOT_DIR}/ci/envs/
+
+cleanup () {
+ docker stop $1
+ docker rm -v $1
+ # We should have already remove running containers when pull the image
+ docker rmi opnfv/yardstick
+}
+
+# Make sure we have latest image
+docker ps | grep opnfv/yardstick-ci |\
+ awk '{print $1}' | xargs -r docker stop &>/dev/null
+ docker ps -a | grep opnfv/yardstick |\
+ awk '{print $1}' | xargs -r docker rm &>/dev/null
+docker pull opnfv/yardstick
+
+id=$(docker run \
+--privileged=true \
+-d \
+-t \
+-e "INSTALLER_TYPE=${INSTALLER_TYPE}" \
+-e "INSTALLER_IP=${INSTALLER_IP}" \
+opnfv/yardstick )
+
+trap 'cleanup $id' SIGHUP SIGINT SIGTERM
+
+${ROOT_DIR}/tests/update_yardstick.sh $id ${rpmdir} ${imagedir}
+
+if [[ -z $? ]]
+then
+ echo "Failed to update the yardstick environment"
+ exit 1
+fi
+
+docker exec $id sh -c "/opt/testexec.sh"
+
+cleanup $id
diff --git a/tests/testexec.sh b/tests/testexec.sh
new file mode 100755
index 000000000..d83ace9ea
--- /dev/null
+++ b/tests/testexec.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+##############################################################################
+## Copyright (c) 2015 Intel Corp.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+set -e
+set -o errexit
+set -o pipefail
+
+: ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'}
+: ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'}
+: ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec
+
+: ${INSTALLER_TYPE:='fuel'}
+: ${INSTALLER_IP:='10.20.0.2'}
+
+: ${POD_NAME:='opnfv-jump-2'}
+: ${EXTERNAL_NET:='net04_ext'}
+
+git_checkout()
+{
+ if git cat-file -e $1^{commit} 2>/dev/null; then
+ # branch, tag or sha1 object
+ git checkout $1
+ else
+ # refspec / changeset
+ git fetch --tags --progress $2 $1
+ git checkout FETCH_HEAD
+ fi
+}
+
+echo
+echo "INFO: Updating yardstick -> $YARDSTICK_BRANCH"
+if [ ! -d $YARDSTICK_REPO_DIR ]; then
+ git clone YARDSTICK_REPO $YARDSTICK_REPO_DIR
+fi
+cd $YARDSTICK_REPO_DIR
+
+
+git checkout master && git pull
+git_checkout $YARDSTICK_BRANCH $YARDSTICK_REPO
+
+export EXTERNAL_NET INSTALLER_TYPE POD_NAME
+
+# Verifiy
+
+DISPATCHER_TYPE=file
+DISPATCHER_FILE_NAME="/tmp/yardstick.out.$$"
+
+exitcode=""
+
+error_exit()
+{
+ local rc=$?
+
+ if [ -z "$exitcode" ]; then
+ # In case of recursive traps (!?)
+ exitcode=$rc
+ fi
+
+ echo "Exiting with RC=$exitcode"
+
+ exit $exitcode
+}
+
+
+install_yardstick()
+{
+ echo
+ echo "========== Installing yardstick =========="
+
+ if ! sudo -E python setup.py install; then
+ echo 'Yardstick installation failed!'
+ exit 1
+ fi
+}
+
+
+run_test()
+{
+ echo
+ echo "========== Running yardstick test suites =========="
+
+ mkdir -p /etc/yardstick
+
+ cat << EOF >> /etc/yardstick/yardstick.conf
+[DEFAULT]
+debug = True
+dispatcher = ${DISPATCHER_TYPE}
+
+[dispatcher_file]
+file_name = ${DISPATCHER_FILE_NAME}
+
+[dispatcher_http]
+timeout = 5
+target = ${DISPATCHER_HTTP_TARGET}
+EOF
+
+ local failed=0
+
+ echo "----------------------------------------------"
+ echo "Running samples/cyclictest-node-context.yaml "
+ echo "----------------------------------------------"
+
+ if ! yardstick task start /opt/cyclictest-node-context.yaml; then
+ echo "Yardstick test FAILED"
+ exit 1
+ fi
+ echo "----------------------------------------------"
+ echo "Dump test result: "
+ cat ${DISPATCHER_FILE_NAME}
+ echo "----------------------------------------------"
+ rm -rf ${DISPATCHER_FILE_NAME}
+}
+
+
+verifiy()
+{
+ GITROOT=$YARDSTICK_REPO_DIR
+
+ cd $GITROOT
+
+ export YARDSTICK_VERSION=$(git rev-parse HEAD)
+
+ # fetch patch
+ git fetch https://QiLiang@gerrit.opnfv.org/gerrit/yardstick refs/changes/33/3633/1 && git checkout FETCH_HEAD
+
+ # If any change needed for yardstick, applied here.
+ if [ -e /opt/yardstick.patch ]
+ then
+ patch -p1 -i /opt/yardstick.patch
+ fi
+ # install yardstick
+ install_yardstick
+
+ trap "error_exit" EXIT SIGTERM
+
+ run_test
+}
+
+
+verifiy
+
diff --git a/tests/update_yardstick.sh b/tests/update_yardstick.sh
new file mode 100755
index 000000000..2e6fd3062
--- /dev/null
+++ b/tests/update_yardstick.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+##############################################################################
+## Copyright (c) 2015 Intel Corp.
+##
+## All rights reserved. This program and the accompanying materials
+## are made available under the terms of the Apache License, Version 2.0
+## which accompanies this distribution, and is available at
+## http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+usage () {
+ echo "update_yardstick.sh container_id rpmdir imagedir"
+ exit 1
+}
+
+if [ $# -ne 3 ] || [ ! -d $2 ] || [ ! -d $3 ]
+then
+ usage
+fi
+
+DBASE_DIR=/opt
+
+ROOTDIR=$(cd $(dirname "$0")/.. && pwd)
+ENVDIR=${ROOTDIR}/ci/envs/
+
+CID=$1
+RPMDIR=$2
+IMGDIR=$3
+
+docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/scripts/"
+docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/rpm/"
+docker exec ${CID} sh -c "mkdir -p ${DBASE_DIR}/image/"
+
+copyfile () {
+ docker cp $1 "${CID}:${DBASE_DIR}/$2"
+ if [[ -z $? ]]
+ then
+ echo "Failed to copy $2"
+ exit 1
+ fi
+}
+
+# Copy the environment setup scripts to the docker image
+copyfile ${ENVDIR}/host-setup0.sh 'scripts/'
+copyfile ${ENVDIR}/host-setup1.sh 'scripts/'
+copyfile ${ENVDIR}/host-config 'scripts/'
+copyfile ${ENVDIR}/guest-setup0.sh 'scripts/'
+copyfile ${ENVDIR}/guest-setup1.sh 'scripts/'
+copyfile ${ENVDIR}/host-run-qemu.sh 'scripts/'
+copyfile ${ENVDIR}/kvm4nfv_key 'yardstick_key'
+
+copyfile "${ROOTDIR}/tests/testexec.sh" 'testexec.sh'
+
+# Copy the test yaml definition to the docker image
+copyfile "${ROOTDIR}/tests/pod.yaml" 'pod.yaml'
+copyfile "${IMGDIR}/guest.img" 'image/'
+
+docker cp "${ROOTDIR}/tests/cyclictest-node-context.yaml" ${CID}:${DBASE_DIR}
+
+# Copy the rpms
+for f in ${RPMDIR}/*.rpm
+do
+ docker cp $f ${CID}:${DBASE_DIR}/rpm/
+done
+
+# If we have any yardstick patch for workaround, copy it
+if [ -e "${ROOTDIR}/tests/yardstick.patch" ]
+then
+ docker cp ${ROOTDIR}/tests/yardstick.patch ${CID}:${DBASE_DIR}/
+fi