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" "memorystress_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 #check if any kernel rpms available for testing
24 rpm_count=`ls -1 $WORKSPACE/build_output/*.rpm 2>/dev/null | wc -l`
25 if [ $rpm_count = 0 ];then
26 echo "This patch is used for building kernel debian packages required by compass installer and \
27 the test environment for testing debain packages is not available"
31 function packetForward {
32 #executing packet forwarding test cases based on the job type.
33 if [ ${test_type} == "verify" ];then
34 echo "packet forwarding test cases are not yet implemented for verify job"
35 packetforward_result=0
36 elif [ ${test_type} == "daily" ];then
37 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP
39 #Waiting for ssh to be available for the host machine.
41 # copy files and rpms and setup environment required for executing test cases
44 #Verifying whether the test node is up and running
47 #Install and Execute packet forwarding test cases
48 runPacketForwarding $test_type
49 packetforward_result=$?
51 echo "Incorrect test type ${test_type}"
56 function getTestParams {
57 HOST_IP=$( setHostIP $test_type )
58 test_time=$( setTestTime $test_type )
63 source $WORKSPACE/ci/cyclicTestTrigger.sh $HOST_IP $test_time $test_type $test_case
64 #Verifying whether the test node is up and running
66 #Waiting for ssh to be available for the host machine.
68 #calculating and verifying sha512sum of the guestimage.
69 if ! verifyGuestImage;then
72 #Update kvmfornfv_cyclictest_${testName}.yaml with test_time and pod.yaml with IP
75 collect_MBWInfo $test_type
76 #Cleaning the environment before running cyclictest through yardstick
78 #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase
79 if runCyclicTest ${ftrace_enable};then
80 cyclictest_result=`expr ${cyclictest_result} + 0`
82 echo "Test case execution FAILED for ${test_case} environment"
83 cyclictest_result=`expr ${cyclictest_result} + 1`
85 echo "Terminating PCM Process"
86 sudo ssh root@${HOST_IP} "pid=\$(ps aux | grep 'pcm' | awk '{print \$2}' | head -1); echo \$pid |xargs kill -SIGTERM"
88 #Collecting the Memory Bandwidth Information using pcm-memory utility
89 function collect_MBWInfo {
91 timeStamp=$(date +%Y%m%d%H%M%S)
92 echo "Running PCM memory to collect memory bandwidth"
93 sudo ssh root@${HOST_IP} "mkdir -p /root/MBWInfo"
94 sudo ssh root@${HOST_IP} "${pcm_memory} 60 &>/root/MBWInfo/MBWInfo_${testType}_${timeStamp} &disown"
96 function install_pcm {
97 sudo ssh root@${HOST_IP} '
98 modelName=`cat /proc/cpuinfo | grep -i "model name" | uniq`
99 if echo "$modelName" | grep -i "xeon" ;then
100 echo "pcm utility supports $modelName processor"
102 echo "check for the pcm utility supported processors"
106 if [ ! -d "pcm" ]; then
107 `git clone https://github.com/opcm/pcm`
110 echo "Disabling NMI Watchdog"
111 echo 0 > /proc/sys/kernel/nmi_watchdog
112 echo "To Access MSR registers installing msr-tools"
113 sudo yum install msr-tools
119 #Execution of testcases based on test type and test name from releng.
120 if [ ${test_type} == "verify" ];then
123 if [ ${ftrace_enable} -eq '1' ]; then
124 for env in ${cyclictest_env_verify[@]}
126 #Enabling ftrace for kernel debugging.
127 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml
128 #Executing cyclictest through yardstick.
132 #Execution of packet forwarding test cases.
135 for env in ${cyclictest_env_verify[@]}
137 #Executing cyclictest through yardstick.
141 #Execution of packet forwarding test cases.
144 if [ ${cyclictest_result} -ne 0 ] || [ ${packetforward_result} -ne 0 ];then
145 echo "Test case FAILED"
150 elif [ ${test_type} == "daily" ];then
151 echo "Daily job test cases execution disabled temporarily"
155 if [ ${test_name} == "packet_forward" ];then
158 #clean the test environment after the test case execution.
159 sudo ssh root@${HOST_IP} "rm -rf /root/workspace/*"
161 if [ ${packetforward_result} -ne 0 ] ; then
162 echo "Execution of packet forwarding test cases FAILED"
165 echo "Executed packet forwarding test cases SUCCESSFULLY"
168 elif [ ${test_name} == "cyclictest" ];then
169 if [ ${ftrace_enable} -eq '1' ]; then
170 for env in ${cyclictest_env_daily[@]}
172 #Enabling ftrace for kernel debugging.
173 sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml
174 #Executing cyclictest through yardstick.
176 #disabling ftrace and collecting the logs to upload to artifact repository.
181 for env in ${cyclictest_env_daily[@]}
183 #Executing cyclictest through yardstick.
188 if [ ${cyclictest_result} -ne 0 ] ; then
189 echo "Cyclictest case execution FAILED"
192 echo "Cyclictest case executed SUCCESSFULLY"
196 elif [ ${test_type} == "merge" ];then
197 echo "Test is not enabled for ${test_type}"
200 echo "Incorrect test type ${test_type}"