X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2FcyclicTestTrigger.sh;h=7ec3616a0aba68442a280129060042cf0882de80;hb=570d93ddbb5e5e54aec9a7c1faf0c24204229c59;hp=ec0477fde5a2e9e5851f2cf1cb6b8dd7fb0cec22;hpb=75f93c362f8cde64b02e243d26bf9061f48adc34;p=kvmfornfv.git diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh index ec0477fde..7ec3616a0 100755 --- a/ci/cyclicTestTrigger.sh +++ b/ci/cyclicTestTrigger.sh @@ -13,12 +13,18 @@ testType=$3 testName=$4 source $WORKSPACE/ci/envs/utils.sh +source $WORKSPACE/ci/envs/host-config KERNELRPM_VERSION=$( getKernelVersion ) +QEMURPM_VERSION=$( getQemuVersion ) if [ -z ${KERNELRPM_VERSION} ];then echo "Kernel RPM not found in build_output Directory" exit 1 fi +if [ -z ${QEMURPM_VERSION} ];then + echo "QEMU RPM not found in build_output Directory" + exit 1 +fi #calculating and verifying sha512sum of the guestimage. function verifyGuestImage { @@ -30,6 +36,29 @@ function verifyGuestImage { fi } +#Verifying the availability of the host after reboot +function connect_host { + n=0 + while [ $n -lt 25 ]; do + host_ping_test="ping -c 1 ${HOST_IP}" + eval $host_ping_test &> /dev/null + if [ ${?} -ne 0 ] ; then + sleep 10 + echo "host machine is still under reboot..trying to connect...." + n=$(($n+1)) + else + echo "resuming the execution of test cases....." + #Waiting for ssh to be available for the host machine. + sleep 30 + break + fi + if [ $n == 24 ];then + echo "Host machine unable to boot-up!" + exit 1 + fi + done +} + #Updating the pod.yaml file with HOST_IP,kvmfornfv_cyclictest_idle_idle.yaml with loops and interval function updateYaml { cd $WORKSPACE/tests/ @@ -82,6 +111,7 @@ function host_clean { sudo ssh root@${HOST_IP} "rpm=\$(rpm -qa | grep 'kernel-${KERNELRPM_VERSION}' | awk '{print \$1}'); rpm -ev \$rpm" sudo ssh root@${HOST_IP} "rm -rf /boot/initramfs-${KERNELRPM_VERSION}*.img" sudo ssh root@${HOST_IP} "grub2-mkconfig -o /boot/grub2/grub.cfg" + sudo ssh root@${HOST_IP} "rpm=\$(rpm -qa | grep 'qemu-${QEMURPM_VERSION}'| awk '{print \$1}'); rpm -ev \$rpm" sudo ssh root@${HOST_IP} "reboot" } @@ -104,7 +134,7 @@ function runCyclicTest { if [ ${?} -ne 0 ] ; then echo "Docker image build failed" id=$(sudo docker ps -a | head -2 | tail -1 | awk '{print $1}'); sudo docker rm -f $id - exit 1 + err_exit 1 fi time_stamp=$(date +%Y%m%d%H%M%S) volume=/tmp/kvmtest-${testType}-${time_stamp} @@ -112,6 +142,7 @@ function runCyclicTest { #copying required files to run yardstick cyclic testcase cp $WORKSPACE/build_output/kernel-${KERNELRPM_VERSION}*.rpm ${volume}/rpm + cp $WORKSPACE/build_output/qemu-${QEMURPM_VERSION}*.rpm ${volume}/rpm cp -r $WORKSPACE/ci/envs/* ${volume}/scripts cp -r $WORKSPACE/tests/kvmfornfv_cyclictest_${testName}.yaml ${volume} cp -r $WORKSPACE/tests/pod.yaml ${volume}/scripts