3 ############################################################
4 ## This script is an interface to trigger the
5 ## cyclicTestTrigger.sh for test type like patch verification,
7 ## Releng will trigger this script by passing test type as
8 ## verify/daily and test name as idle_idle/stress_idle/
9 ## packet_forward as arguments.
10 ## Verify Job runs idle_idle,packet_forward test
11 ## daily job runs base on the test name parameter
12 ############################################################
17 cyclictest_env_verify=("idle_idle" "cpustress_idle" "memorystress_idle" "iostress_idle") #cyclictest environment
18 cyclictest_env_daily=("idle_idle" "cpustress_idle" "memorystress_idle" "iostress_idle")
19 cyclictest_result=0 #exit code of cyclictest
20 packetforward_result=0 #exit code of packet forward
21 source $WORKSPACE/ci/envs/host-config
23 function packetForward {
24 #executing packet forwarding test cases based on the job type.
25 if [ ${test_type} == "verify" ];then
26 echo "packet forwarding test cases are not yet implemented for verify job"
27 packetforward_result=0
28 elif [ ${test_type} == "daily" ];then
29 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
31 #Waiting for ssh to be available for the host machine.
33 # copy files and rpms and setup environment required for executing test cases
36 #Verifying whether the test node is up and running
39 #Install and Execute packet forwarding test cases
40 runPacketForwarding $test_type
41 packetforward_result=$?
43 echo "Incorrect test type ${test_type}"
50 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
51 #Verifying whether the test node is up and running
53 #Waiting for ssh to be available for the host machine.
55 #calculating and verifying sha512sum of the guestimage.
56 if ! verifyGuestImage;then
59 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
62 collect_MBWInfo $test_type
63 #Cleaning the environment before running cyclictest through yardstick
65 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
67 cyclictest_result=`expr ${cyclictest_result} + 0`
69 echo "Test case execution FAILED for ${test_case} environment"
70 cyclictest_result=`expr ${cyclictest_result} + 1`
72 echo "Terminating PCM Process"
73 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
75 function collect_MBWInfo {
76 #Collecting the Memory Bandwidth Information using pcm-memory utility
77 source $WORKSPACE/ci/envs/host-config
79 timeStamp=$(date +%Y%m%d%H%M%S)
80 echo "Running PCM memory to collect memory bandwidth"
81 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
82 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
84 function install_pcm {
85 source $WORKSPACE/ci/envs/host-config
86 sudo ssh root@${HOST_IP} '
87 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
88 if echo "$modelName" | grep -i "xeon" ;then
89 echo "pcm utility supports $modelName processor"
91 echo "check for the pcm utility supported processors"
95 if [ ! -d "pcm" ]; then
96 `git clone https://github.com/opcm/pcm`
99 echo "Disabling NMI Watchdog"
100 echo 0 > /proc/sys/kernel/nmi_watchdog
101 echo "To Access MSR registers installing msr-tools"
102 sudo yum install msr-tools
108 function ftrace_disable {
109 sudo ssh root@${HOST_IP} "sh /root/workspace/scripts/disbale-trace.sh"
110 sudo ssh root@${HOST_IP} "cd /tmp ; a=\$(ls -rt | tail -1) ; echo \$a ; mv \$a cyclictest_${env}.txt"
111 sudo mkdir -p $WORKSPACE/build_output/log/kernel_trace
112 sudo scp root@${HOST_IP}:/tmp/cyclictest_${env}.txt $WORKSPACE/build_output/log/kernel_trace/
115 #Execution of testcases based on test type and test name from releng.
116 if [ ${test_type} == "verify" ];then
117 HOST_IP="10.10.100.21"
120 if [ ${ftrace_enable} -eq '1' ]; then
121 for env in ${cyclictest_env_verify[@]}
123 #Enabling ftrace for kernel debugging.
124 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
125 #Executing cyclictest through yardstick.
127 #disabling ftrace and collecting the logs to upload to artifact repository.
131 #Execution of packet forwarding test cases.
134 for env in ${cyclictest_env_verify[@]}
136 #Executing cyclictest through yardstick.
140 #Execution of packet forwarding test cases.
143 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
144 echo "Test case FAILED"
149 elif [ ${test_type} == "daily" ];then
150 HOST_IP="10.10.100.22"
151 test_time=3600000 #1h
153 if [ ${test_name} == "packet_forward" ];then
156 #clean the test environment after the test case execution.
157 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
159 if [ ${packetforward_result} -ne 0 ] ; then
160 echo "Execution of packet forwarding test cases FAILED"
163 echo "Executed packet forwarding test cases SUCCESSFULLY"
166 elif [ ${test_name} == "cyclictest" ];then
167 if [ ${ftrace_enable} -eq '1' ]; then
168 for env in ${cyclictest_env_daily[@]}
170 #Enabling ftrace for kernel debugging.
171 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
172 #Executing cyclictest through yardstick.
174 #disabling ftrace and collecting the logs to upload to artifact repository.
179 for env in ${cyclictest_env_daily[@]}
181 #Executing cyclictest through yardstick.
186 if [ ${cyclictest_result} -ne 0 ] ; then
187 echo "Cyclictest case execution FAILED"
190 echo "Cyclictest case executed SUCCESSFULLY"
194 elif [ ${test_type} == "merge" ];then
195 echo "Test is not enabled for ${test_type}"
198 echo "Incorrect test type ${test_type}"