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
66 if runCyclicTest ${ftrace_enable};then
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 #Execution of testcases based on test type and test name from releng.
109 if [ ${test_type} == "verify" ];then
110 HOST_IP="10.10.100.21"
113 if [ ${ftrace_enable} -eq '1' ]; then
114 for env in ${cyclictest_env_verify[@]}
116 #Enabling ftrace for kernel debugging.
117 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
118 #Executing cyclictest through yardstick.
122 #Execution of packet forwarding test cases.
125 for env in ${cyclictest_env_verify[@]}
127 #Executing cyclictest through yardstick.
131 #Execution of packet forwarding test cases.
134 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
135 echo "Test case FAILED"
140 elif [ ${test_type} == "daily" ];then
141 HOST_IP="10.10.100.22"
142 test_time=3600000 #1h
144 if [ ${test_name} == "packet_forward" ];then
147 #clean the test environment after the test case execution.
148 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
150 if [ ${packetforward_result} -ne 0 ] ; then
151 echo "Execution of packet forwarding test cases FAILED"
154 echo "Executed packet forwarding test cases SUCCESSFULLY"
157 elif [ ${test_name} == "cyclictest" ];then
158 if [ ${ftrace_enable} -eq '1' ]; then
159 for env in ${cyclictest_env_daily[@]}
161 #Enabling ftrace for kernel debugging.
162 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
163 #Executing cyclictest through yardstick.
165 #disabling ftrace and collecting the logs to upload to artifact repository.
170 for env in ${cyclictest_env_daily[@]}
172 #Executing cyclictest through yardstick.
177 if [ ${cyclictest_result} -ne 0 ] ; then
178 echo "Cyclictest case execution FAILED"
181 echo "Cyclictest case executed SUCCESSFULLY"
185 elif [ ${test_type} == "merge" ];then
186 echo "Test is not enabled for ${test_type}"
189 echo "Incorrect test type ${test_type}"