Add script for running yardstick tasks back-to-back 82/1182/4
authorKristian Hunt <kristian.hunt@gmail.com>
Thu, 13 Aug 2015 12:48:30 +0000 (14:48 +0200)
committerJörgen Karlsson <jorgen.w.karlsson@ericsson.com>
Wed, 26 Aug 2015 11:10:50 +0000 (11:10 +0000)
This script enables to run multiple yardstick tasks in the yardstick
daily build without having to change the Jenkins job in the releng
repository.

This script should be executed from the main yardstick directory just
as run_tests.sh.

If at least one of the tasks listed returns a non-zero value then the
script continues executing, but in the end will exit with value 1.

JIRA: YARDSTICK-106

Change-Id: I8a6bb7e6c03ec551709ff66a45aad7257fb36e92
Signed-off-by: Kristian Hunt <kristian.hunt@gmail.com>
ci/run_tasks.sh [new file with mode: 0644]

diff --git a/ci/run_tasks.sh b/ci/run_tasks.sh
new file mode 100644 (file)
index 0000000..27ccb3a
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+##############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+#
+# 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
+##############################################################################
+
+# Run yardstick tasks back-to-back
+# This script is called from yardstick-{pod} job and decides which tasks
+# are executed as part of that job.
+
+
+# verify that virtual environment is activated
+# assumes the virtual environment has been created as described in README.rst
+if [[ ! $(which python | grep venv) ]]; then
+    echo "Unable to activate venv...Exiting"
+    exit 1
+fi
+
+EXIT_CODE=0
+
+# Define tasks to be run
+TASK_FILE_NAMES[0]='samples/ping.yaml'
+TASK_FILE_NAMES[1]='samples/iperf3.yaml'
+TASK_FILE_NAMES[2]='samples/pktgen.yaml'
+TASK_FILE_NAMES[3]='samples/fio.yaml'
+
+# Execute tasks
+for TASK_FILE in ${TASK_FILE_NAMES[@]}
+do
+    echo "Executing task from file: $TASK_FILE"
+    yardstick -d task start $TASK_FILE
+
+    if [ $? -ne 0 ]; then
+        EXIT_CODE=1
+    fi
+done
+
+exit $EXIT_CODE
\ No newline at end of file