X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2FcyclicTestTrigger.sh;h=f4a51628206bf8a87e9f57acd0a492e7c5dc2a05;hb=7ea7eea6dab8c1b40c2626eead4ced80e77f87b9;hp=7a0c2a49b5e2d5c5c98da4acda2050bca86fe4bb;hpb=96e7a4ce5a4d186ed8297af9fd4333c510f2b9a1;p=kvmfornfv.git diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh index 7a0c2a49b..f4a516282 100755 --- a/ci/cyclicTestTrigger.sh +++ b/ci/cyclicTestTrigger.sh @@ -39,6 +39,14 @@ function verifyGuestImage { fi } +#disabling ftrace and collecting the logs to upload to artifact repository. +function ftrace_disable { + 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/ + sudo ssh root@${HOST_IP} "cd /tmp ; rm -rf cyclictest_${env}.txt" +} + #Verifying the availability of the host after reboot function connect_host { n=0 @@ -124,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 @@ -140,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 @@ -158,6 +186,8 @@ 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 @@ -165,21 +195,21 @@ 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" == "iostress_idle" ];then + + #Disabling ftrace after completion of executing test cases. + if [ ${ftrace_enable} -eq '1' ]; then + ftrace_disable + fi + + if [ "$testName" == "memorystress_idle" ];then copyLogs fi @@ -205,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 +}