This patch includes scripts to verify the sha512sum of the 61/21261/5
authorkalyanreddy <reddyx.gundarapu@intel.com>
Fri, 16 Sep 2016 10:56:43 +0000 (16:26 +0530)
committerKalyanreddy <reddyx.gundarapu@intel.com>
Wed, 21 Sep 2016 10:15:41 +0000 (15:45 +0530)
guest image. Also contains scripts to exit the test if the
test_type is not verify/daily/merge.

Change-Id: Ibbb0d30302095282b539db7293084de007db6ddc
Co-Authored-By: Shravani <shravani.p@tcs.com>
Signed-off-by: kalyanreddy <reddyx.gundarapu@intel.com>
ci/cyclicTestTrigger.sh
ci/envs/cyclictest.sh
ci/envs/utils.sh
ci/test_kvmfornfv.sh
tests/cyclictest-node-context.yaml

index bd6e290..e00b367 100755 (executable)
@@ -19,6 +19,16 @@ if [ -z ${KERNELRPM_VERSION} ];then
    exit 1
 fi
 
+#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,cyclictest-node-context.yaml with loops and interval
 function updateYaml {
    cd $WORKSPACE/tests/
@@ -62,12 +72,12 @@ function runCyclicTest {
    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/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"
-
+   output=$?
    #Verifying the results of cyclictest
    result=`grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
 
@@ -79,12 +89,17 @@ function runCyclicTest {
       echo "####################################################"
       env_clean
       host_clean
-      exit 0
+      if [ $output != 0 ];then
+         echo "Some problem with Yardstick.Check cyclictest.sh"
+         return 1
+      else
+         return 0
+      fi
    else
       echo "Testcase failed"
       echo `grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`
       env_clean
       host_clean
-      exit 1
+      return 1
    fi
 }
index 747f347..4c5440d 100755 (executable)
@@ -7,7 +7,7 @@
 source utils.sh
 
 HOST_IP=$( getHostIP )
-pod_config='/opt/pod.yaml'
+pod_config='/opt/scripts/pod.yaml'
 cyclictest_context_file='/opt/cyclictest-node-context.yaml'
 
 if [ ! -f ${pod_config} ] ; then
@@ -25,5 +25,10 @@ sudo ssh root@$HOST_IP "cp /root/images/guest1.qcow2 /root/"
 
 #Running cyclictest through yardstick
 yardstick -d task start ${cyclictest_context_file}
+output=$?
 chmod 777 /tmp/yardstick.out
 cat /tmp/yardstick.out  > /opt/yardstick.out
+if [ $output != 0 ];then
+   echo "Someproblem with execution of Yardstick"
+   exit 1
+fi
index f582b5a..5db55be 100755 (executable)
@@ -18,6 +18,12 @@ function getKernelVersion {
 
 #Get the IP address from pod.yaml file (example ip : 10.2.117.23)
 function getHostIP {
-   HOST_IP=`grep 'ip' $WORKSPACE/tests/pod.yaml | awk -F ': ' '{print $NF}' | tail -1`
+   host_dir="/root/workspace/scripts/"
+   container_dir="/opt/scripts/"
+   if [ -d "$container_dir" ];then
+      HOST_IP=`grep 'ip' $container_dir/pod.yaml | awk -F ': ' '{print $NF}' | tail -1`
+   elif [ -d "$host_dir" ];then
+      HOST_IP=`grep 'ip' $host_dir/pod.yaml | awk -F ': ' '{print $NF}' | tail -1`
+   fi
    echo $HOST_IP
 }
index 858aaf3..c739e80 100755 (executable)
@@ -19,10 +19,18 @@ elif [ ${test_type} == "daily" ];then
 elif [ ${test_type} == "merge" ];then
    echo "Test is not enabled for ${test_type}"
    exit 0
+else
+   echo "Incorrect test type ${test_type}"
+   exit 1
 fi
 
 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type
 
+#calculating and verifying sha512sum of the guestimage.
+if ! verifyGuestImage;then
+   exit 1
+fi
+
 #Update cyclictest-node-context.yaml with test_time and pod.yaml with IP
 updateYaml
 
@@ -30,4 +38,8 @@ updateYaml
 env_clean
 
 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
-runCyclicTest
+if runCyclicTest;then
+   exit 0
+else
+   exit 1
+fi
index 2dd74d9..3125cb7 100644 (file)
@@ -47,4 +47,4 @@ scenarios:
 context:
   type: Node
   name: LF
-  file: /opt/pod.yaml
+  file: /opt/scripts/pod.yaml