3 #############################################################
4 ## This script will launch ubuntu docker container
5 ## runs cyclictest through yardstick
6 ## and verifies the test results.
7 ############################################################
9 docker_image_dir=$WORKSPACE/docker_image_build
11 container_id=`sudo docker ps -a | grep kvmfornfv |awk '{print $1}'`
12 sudo docker rm $container_id
13 sudo ssh root@10.2.117.23 "rm -rf /root/workspace/*"
14 sudo ssh root@10.2.117.23 "pid=\$(ps aux | grep 'qemu' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
15 sudo rm -rf /tmp/kvmtest-*
18 #Cleaning up the test environment before running cyclictest through yardstick.
21 #Creating a docker image with yardstick installed.
22 ( cd ${docker_image_dir}; sudo docker build -t kvmfornfv:latest --no-cache=true . )
23 if [ ${?} -ne 0 ] ; then
24 echo "Docker image build failed"
25 id=$(sudo docker ps -a | head -2 | tail -1 | awk '{print $1}'); sudo docker rm -f $id
29 time_stamp=$(date +%Y%m%d%H%M%S)
30 volume=/tmp/kvmtest-${time_stamp}
31 mkdir -p $volume/{image,rpm,scripts}
33 #copying required files to run yardstick cyclic testcase
34 mv $WORKSPACE/build_output/kernel-4.4*.rpm $volume/rpm
35 cp -r $WORKSPACE/ci/envs/* $volume/scripts
36 cp -r $WORKSPACE/tests/cyclictest-node-context.yaml $volume
37 cp -r $WORKSPACE/tests/pod.yaml $volume
39 #Launching ubuntu docker container to run yardstick
40 sudo docker run -i -v $volume:/opt --net=host --name kvmfornfv \
41 kvmfornfv:latest /bin/bash -c "cd /opt/scripts && ls; ./cyclictest.sh"
43 #Verifying the results of cyclictest
44 result=`grep -o '"errors":[^,]*' $volume/yardstick.out | awk -F '"' '{print $4}'`
46 if [ -z "$result" ]; then
47 echo "####################################################"
49 echo `grep -o '"data":[^}]*' $volume/yardstick.out | awk -F '{' '{print $2}'`
51 echo "####################################################"
55 echo "Testcase failed"
56 echo `grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'`