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 #Checking which test cases will be executed first and last from the list to perform cleaning operations.
64 first_test_case=cyclictest_env_$test_type[0]
65 last_test_case=cyclictest_env_$test_type[-1]
66 #Cleaning the environment before running cyclictest through yardstick
67 if [ ${test_case} == "${!first_test_case}" ];then
70 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'qemu' | awk '{print \$2}' | head -1); echo \$pid |xargs kill"
72 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
74 cyclictest_result=`expr ${cyclictest_result} + 0`
76 echo "Test case execution FAILED for ${test_case} environment"
77 cyclictest_result=`expr ${cyclictest_result} + 1`
79 echo "Terminating PCM Process"
80 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
81 if [ ${test_case} != "${!last_test_case}" ];then
82 sudo ssh root@${HOST_IP} "reboot"
85 function collect_MBWInfo {
86 #Collecting the Memory Bandwidth Information using pcm-memory utility
87 source $WORKSPACE/ci/envs/host-config
89 timeStamp=$(date +%Y%m%d%H%M%S)
90 echo "Running PCM memory to collect memory bandwidth"
91 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
92 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
94 function install_pcm {
95 source $WORKSPACE/ci/envs/host-config
96 sudo ssh root@${HOST_IP} '
97 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
98 if echo "$modelName" | grep -i "xeon" ;then
99 echo "pcm utility supports $modelName processor"
101 echo "check for the pcm utility supported processors"
105 if [ ! -d "pcm" ]; then
106 `git clone https://github.com/opcm/pcm`
109 echo "Disabling NMI Watchdog"
110 echo 0 > /proc/sys/kernel/nmi_watchdog
111 echo "To Access MSR registers installing msr-tools"
112 sudo yum install msr-tools
118 function ftrace_disable {
119 sudo ssh root@${HOST_IP} "sh /root/workspace/scripts/disbale-trace.sh"
120 sudo ssh root@${HOST_IP} "cd /tmp ; a=\$(ls -rt | tail -1) ; echo \$a ; mv \$a cyclictest_${env}.txt"
121 sudo mkdir -p $WORKSPACE/build_output/log/kernel_trace
122 sudo scp root@${HOST_IP}:/tmp/cyclictest_${env}.txt $WORKSPACE/build_output/log/kernel_trace/
125 #Execution of testcases based on test type and test name from releng.
126 if [ ${test_type} == "verify" ];then
127 HOST_IP="10.10.100.21"
130 if [ ${ftrace_enable} -eq '1' ]; then
131 for env in ${cyclictest_env_verify[@]}
133 #Enabling ftrace for kernel debugging.
134 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
135 #Executing cyclictest through yardstick.
137 #disabling ftrace and collecting the logs to upload to artifact repository.
141 #Execution of packet forwarding test cases.
144 for env in ${cyclictest_env_verify[@]}
146 #Executing cyclictest through yardstick.
152 #Execution of packet forwarding test cases.
155 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
156 echo "Test case FAILED"
161 elif [ ${test_type} == "daily" ];then
162 HOST_IP="10.10.100.22"
163 test_time=3600000 #1h
165 if [ ${test_name} == "packet_forward" ];then
168 #clean the test environment after the test case execution.
169 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
171 if [ ${packetforward_result} -ne 0 ] ; then
172 echo "Execution of packet forwarding test cases FAILED"
175 echo "Executed packet forwarding test cases SUCCESSFULLY"
178 elif [ ${test_name} == "cyclictest" ];then
179 if [ ${ftrace_enable} -eq '1' ]; then
180 for env in ${cyclictest_env_daily[@]}
182 #Enabling ftrace for kernel debugging.
183 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
184 #Executing cyclictest through yardstick.
186 #disabling ftrace and collecting the logs to upload to artifact repository.
191 for env in ${cyclictest_env_daily[@]}
193 #Executing cyclictest through yardstick.
200 if [ ${cyclictest_result} -ne 0 ] ; then
201 echo "Cyclictest case execution FAILED"
204 echo "Cyclictest case executed SUCCESSFULLY"
208 elif [ ${test_type} == "merge" ];then
209 echo "Test is not enabled for ${test_type}"
212 echo "Incorrect test type ${test_type}"