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}"
48 function getTestParams {
49 HOST_IP=$( setHostIP $test_type )
50 test_time=$( setTestTime $test_type )
55 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
56 #Verifying whether the test node is up and running
58 #Waiting for ssh to be available for the host machine.
60 #calculating and verifying sha512sum of the guestimage.
61 if ! verifyGuestImage;then
64 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
67 collect_MBWInfo $test_type
68 #Cleaning the environment before running cyclictest through yardstick
70 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
71 if runCyclicTest ${ftrace_enable};then
72 cyclictest_result=`expr ${cyclictest_result} + 0`
74 echo "Test case execution FAILED for ${test_case} environment"
75 cyclictest_result=`expr ${cyclictest_result} + 1`
77 echo "Terminating PCM Process"
78 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
80 #Collecting the Memory Bandwidth Information using pcm-memory utility
81 function collect_MBWInfo {
83 timeStamp=$(date +%Y%m%d%H%M%S)
84 echo "Running PCM memory to collect memory bandwidth"
85 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
86 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
88 function install_pcm {
89 sudo ssh root@${HOST_IP} '
90 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
91 if echo "$modelName" | grep -i "xeon" ;then
92 echo "pcm utility supports $modelName processor"
94 echo "check for the pcm utility supported processors"
98 if [ ! -d "pcm" ]; then
99 `git clone https://github.com/opcm/pcm`
102 echo "Disabling NMI Watchdog"
103 echo 0 > /proc/sys/kernel/nmi_watchdog
104 echo "To Access MSR registers installing msr-tools"
105 sudo yum install msr-tools
111 #Execution of testcases based on test type and test name from releng.
112 if [ ${test_type} == "verify" ];then
115 if [ ${ftrace_enable} -eq '1' ]; then
116 for env in ${cyclictest_env_verify[@]}
118 #Enabling ftrace for kernel debugging.
119 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
120 #Executing cyclictest through yardstick.
124 #Execution of packet forwarding test cases.
127 for env in ${cyclictest_env_verify[@]}
129 #Executing cyclictest through yardstick.
133 #Execution of packet forwarding test cases.
136 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
137 echo "Test case FAILED"
142 elif [ ${test_type} == "daily" ];then
145 if [ ${test_name} == "packet_forward" ];then
148 #clean the test environment after the test case execution.
149 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
151 if [ ${packetforward_result} -ne 0 ] ; then
152 echo "Execution of packet forwarding test cases FAILED"
155 echo "Executed packet forwarding test cases SUCCESSFULLY"
158 elif [ ${test_name} == "cyclictest" ];then
159 if [ ${ftrace_enable} -eq '1' ]; then
160 for env in ${cyclictest_env_daily[@]}
162 #Enabling ftrace for kernel debugging.
163 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
164 #Executing cyclictest through yardstick.
166 #disabling ftrace and collecting the logs to upload to artifact repository.
171 for env in ${cyclictest_env_daily[@]}
173 #Executing cyclictest through yardstick.
178 if [ ${cyclictest_result} -ne 0 ] ; then
179 echo "Cyclictest case execution FAILED"
182 echo "Cyclictest case executed SUCCESSFULLY"
186 elif [ ${test_type} == "merge" ];then
187 echo "Test is not enabled for ${test_type}"
190 echo "Incorrect test type ${test_type}"