X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2FcyclicTestTrigger.sh;h=f4a51628206bf8a87e9f57acd0a492e7c5dc2a05;hb=7ea7eea6dab8c1b40c2626eead4ced80e77f87b9;hp=6765569f678536d919e6dcda5c88b2ef21a3a2aa;hpb=af8d29d3d6119cf43344970023f0548a28922234;p=kvmfornfv.git diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh index 6765569f6..f4a516282 100755 --- a/ci/cyclicTestTrigger.sh +++ b/ci/cyclicTestTrigger.sh @@ -41,7 +41,6 @@ function verifyGuestImage { #disabling ftrace and collecting the logs to upload to artifact repository. function ftrace_disable { - sudo ssh root@${HOST_IP} "sh /root/workspace/scripts/disable_trace.sh" sudo ssh root@${HOST_IP} "cd /tmp ; mv trace.txt cyclictest_${env}.txt" mkdir -p $WORKSPACE/build_output/log/kernel_trace scp root@${HOST_IP}:/tmp/cyclictest_${env}.txt $WORKSPACE/build_output/log/kernel_trace/ @@ -133,13 +132,32 @@ function cleanup { env_clean host_clean if [ $output != 0 ];then - echo "Yardstick Failed.Please check cyclictest.sh" + echo "Yardstick Failed.Please check your testcase" return 1 else return 0 fi } +#environment setup for executing cyclictest and live migration test cases +function setUpEnv { + test=$1 + time_stamp=$(date +%Y%m%d%H%M%S) + volume=/tmp/kvmtest-${testType}-${time_stamp} + mkdir -p $volume/{image,rpm,scripts} + #copying required files to run yardstick cyclic testcase + cp $WORKSPACE/build_output/kernel-${KERNELRPM_VERSION}*.rpm ${volume}/rpm + cp $WORKSPACE/build_output/kernel-devel-${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/pod.yaml ${volume}/scripts + if [ "$test" == "cyclictest" ];then + cp -r $WORKSPACE/tests/kvmfornfv_cyclictest_${testName}.yaml ${volume} + else + cp -r $WORKSPACE/tests/migrate-node-context.yaml ${volume} + fi +} + #environment setup for executing packet forwarding test cases function setUpPacketForwarding { #copying required files to run packet forwarding test cases @@ -149,6 +167,7 @@ function setUpPacketForwarding { #Copying the host configuration scripts on to host scp -r $WORKSPACE/ci/envs/* root@$HOST_IP:/root/workspace/scripts scp -r $WORKSPACE/tests/vsperf.conf* root@$HOST_IP:/root/workspace/scripts + scp -r $WORKSPACE/tests/pod.yaml root@$HOST_IP:/root/workspace/scripts scp -r $WORKSPACE/build_output/kernel-${KERNELRPM_VERSION}*.rpm root@$HOST_IP:/root/workspace/rpm scp -r $WORKSPACE/build_output/kernel-devel-${KERNELRPM_VERSION}*.rpm root@$HOST_IP:/root/workspace/rpm scp -r $WORKSPACE/build_output/qemu-${QEMURPM_VERSION}*.rpm root@$HOST_IP:/root/workspace/rpm @@ -168,6 +187,7 @@ function runPacketForwarding { #Creating a docker image with yardstick installed and Verify the results of cyclictest function runCyclicTest { ftrace_enable=$1 + variable=$2 docker_image_dir=$WORKSPACE/docker_image_build ( cd ${docker_image_dir}; sudo docker build -t kvmfornfv:latest --no-cache=true . ) if [ ${?} -ne 0 ] ; then @@ -175,29 +195,24 @@ function runCyclicTest { id=$(sudo docker ps -a | head -2 | tail -1 | awk '{print $1}'); sudo docker rm -f $id exit 1 fi - time_stamp=$(date +%Y%m%d%H%M%S) - volume=/tmp/kvmtest-${testType}-${time_stamp} - mkdir -p $volume/{image,rpm,scripts} - #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 + + #setting up the environment for cyclictest + setUpEnv $variable #Launching ubuntu docker container to run yardstick sudo docker run -i -v ${volume}:/opt --net=host --name kvmfornfv_${testType}_${testName} \ kvmfornfv:latest /bin/bash -c "cd /opt/scripts && ls; ./cyclictest.sh $testType $testName" cyclictest_output=$? - if [ "$testName" == "memorystress_idle" ];then - copyLogs - fi #Disabling ftrace after completion of executing test cases. if [ ${ftrace_enable} -eq '1' ]; then ftrace_disable fi + if [ "$testName" == "memorystress_idle" ];then + copyLogs + fi + #Verifying the results of cyclictest if [ "$testType" == "verify" ];then result=`grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'` @@ -220,3 +235,22 @@ function runCyclicTest { cleanup $cyclictest_output fi } +function runLiveMigration { + echo "In live migration function" + test_env=$1 + variable=$2 + #Setting up the environment for live migration test case + setUpEnv $variable + #Launching ubuntu docker container to run yardstick + sudo docker run -i -v ${volume}:/opt --net=host --name kvmfornfv_lm_${test_env} \ + kvmfornfv:latest /bin/bash -c "cd /opt/scripts && ls; ./lmtest.sh " + lmtest_result=$? + #Verifying the results of livemigration + if [ ${lmtest_result} -ne 0 ];then + env_clean + host_clean + return 1 + else + cleanup $lmtest_result + fi +}