X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Fenvs%2Futils.sh;h=5e4f1c4702dd84ff2d73f542e3e1ef8047897819;hb=878d38941df56e0392cb652efe3c5996592e7f39;hp=f582b5aac97ddd22853068ccb8945f0458f8c474;hpb=3dbc3510f0107b73c1d3943937218d2dcf5353b3;p=kvmfornfv.git diff --git a/ci/envs/utils.sh b/ci/envs/utils.sh index f582b5aac..5e4f1c470 100755 --- a/ci/envs/utils.sh +++ b/ci/envs/utils.sh @@ -16,8 +16,39 @@ function getKernelVersion { echo ${RPMVERSION} } -#Get the IP address from pod.yaml file (example ip : 10.2.117.23) +#Get the IP address from pod.yaml file (example ip : 10.10.100.22) 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 } +#Get the Qemu version from RPM generated(example:qemu-2.6.0-1.x86_64.rpm) +function getQemuVersion { + rpm_dir="/root/workspace/rpm/" + if [ -d "$WORKSPACE" ];then + cd $WORKSPACE/build_output 2>/dev/null; qemuRPM=`ls qemu-[[:digit:]]* 2>/dev/null` + RPMVERSION=`echo ${qemuRPM}|awk -F '-' '{print $2}' | awk -F '-' '{print $NF}'` + elif [ -d "$rpm_dir" ];then + cd $rpm_dir 2>/dev/null; qemuRPM=`ls qemu-[[:digit:]]* 2>/dev/null` + RPMVERSION=`echo ${qemuRPM}|awk -F '-' '{print $2}' | awk -F '-' '{print $NF}'` + fi + echo ${RPMVERSION} +} +#Check RPM names to continue the execution of testcases +function checkRPMNames { + rpm_dir="/root/workspace/rpm" + if [ -d "$WORKSPACE" ];then + cd $WORKSPACE/build_output 2>/dev/null;RPMCOUNT=`ls kvmfornfv-* | wc -l` + if [ $RPMCOUNT -ne 0 ];then + echo "Testcases are not executed for apex_build" + exit 0 + else + echo "Continue test execution" + fi + fi +}