X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=ci%2FcyclicTestTrigger.sh;fp=ci%2FcyclicTestTrigger.sh;h=d8370fd71b48d65f1714779837076f1c367cbb87;hb=2966c910ccaaa11e69ccfc08d6185c3520a2e8cb;hp=8a805e9365aa9032a14703c9054688a67d1df518;hpb=8131fe4accd335eb9b15ca0dd4a2e4a776ab9727;p=kvmfornfv.git diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh index 8a805e936..d8370fd71 100755 --- a/ci/cyclicTestTrigger.sh +++ b/ci/cyclicTestTrigger.sh @@ -55,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 { @@ -77,30 +88,28 @@ function runCyclicTest { #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" - output=$? + 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 - if [ $output != 0 ];then - echo "Some problem with Yardstick.Check cyclictest.sh" - return 1 + 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 - return 0 + 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 - return 1 + cleanup $cyclictest_output fi }