summaryrefslogtreecommitdiffstats
path: root/ci/cyclicTestTrigger.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ci/cyclicTestTrigger.sh')
-rwxr-xr-xci/cyclicTestTrigger.sh69
1 files changed, 47 insertions, 22 deletions
diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh
index bd6e29038..6241452a2 100755
--- a/ci/cyclicTestTrigger.sh
+++ b/ci/cyclicTestTrigger.sh
@@ -19,17 +19,28 @@ if [ -z ${KERNELRPM_VERSION} ];then
exit 1
fi
-#Updating the pod.yaml file with HOST_IP,cyclictest-node-context.yaml with loops and interval
+#calculating and verifying sha512sum of the guestimage.
+function verifyGuestImage {
+ scp $WORKSPACE/build_output/guest1.sha512 root@${HOST_IP}:/root/images
+ checksum=$(sudo ssh root@${HOST_IP} "cd /root/images/ && sha512sum -c guest1.sha512 | awk '{print \$2}'")
+ if [ "$checksum" != "OK" ]; then
+ echo "Something wrong with the image, please verify"
+ return 1
+ fi
+}
+
+#Updating the pod.yaml file with HOST_IP,kvmfornfv_cyclictest_idle_idle.yaml with loops and interval
function updateYaml {
cd $WORKSPACE/tests/
sed -ri "s/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/${HOST_IP}/" pod.yaml
- sed -ri "s/loops: [0-9]*/loops: ${testTime}/" cyclictest-node-context.yaml
- sed -ri "s/interval: [0-9]*/interval: 1000/" cyclictest-node-context.yaml
+ sed -ri "s/loops: [0-9]*/loops: ${testTime}/" kvmfornfv_cyclictest_idle_idle.yaml
+ sed -ri "0,/interval: [0-9]*/s//interval: 1000/" kvmfornfv_cyclictest_idle_idle.yaml
}
#cleaning the environment after executing the test through yardstick.
function env_clean {
container_id=`sudo docker ps -a | grep kvmfornfv_${testType} |awk '{print \$1}'|sed -e 's/\r//g'`
+ sudo docker stop ${container_id}
sudo docker rm ${container_id}
sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'qemu' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
@@ -44,6 +55,17 @@ function host_clean {
sudo ssh root@${HOST_IP} "reboot"
}
+function cleanup {
+ output=$1
+ env_clean
+ host_clean
+ if [ $output != 0 ];then
+ echo "Yardstick Failed.Please check cyclictest.sh"
+ return 1
+ else
+ return 0
+ fi
+}
#Creating a docker image with yardstick installed and Verify the results of cyclictest
function runCyclicTest {
@@ -61,30 +83,33 @@ function runCyclicTest {
#copying required files to run yardstick cyclic testcase
mv $WORKSPACE/build_output/kernel-${KERNELRPM_VERSION}*.rpm ${volume}/rpm
cp -r $WORKSPACE/ci/envs/* ${volume}/scripts
- cp -r $WORKSPACE/tests/cyclictest-node-context.yaml ${volume}
- cp -r $WORKSPACE/tests/pod.yaml ${volume}
+ cp -r $WORKSPACE/tests/kvmfornfv_cyclictest_idle_idle.yaml ${volume}
+ cp -r $WORKSPACE/tests/pod.yaml ${volume}/scripts
#Launching ubuntu docker container to run yardstick
sudo docker run -i -v ${volume}:/opt --net=host --name kvmfornfv_${testType} \
- kvmfornfv:latest /bin/bash -c "cd /opt/scripts && ls; ./cyclictest.sh"
-
+ kvmfornfv:latest /bin/bash -c "cd /opt/scripts && ls; ./cyclictest.sh $testType"
+ cyclictest_output=$?
#Verifying the results of cyclictest
- result=`grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
- if [ -z "${result}" ]; then
- echo "####################################################"
- echo ""
- echo `grep -o '"data":[^}]*' ${volume}/yardstick.out | awk -F '{' '{print $2}'`
- echo ""
- echo "####################################################"
- env_clean
- host_clean
- exit 0
+ if [ "$testType" == "verify" ];then
+ result=`grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
+
+ if [ -z "${result}" ]; then
+ echo "####################################################"
+ echo ""
+ echo `grep -o '"data":[^}]*' ${volume}/yardstick.out | awk -F '{' '{print $2}'`
+ echo ""
+ echo "####################################################"
+ cleanup $cyclictest_output
+ else
+ echo "Testcase failed"
+ echo `grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
+ env_clean
+ host_clean
+ return 1
+ fi
else
- echo "Testcase failed"
- echo `grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
- env_clean
- host_clean
- exit 1
+ cleanup $cyclictest_output
fi
}