diff options
-rwxr-xr-x | ci/cyclicTestTrigger.sh | 15 | ||||
-rwxr-xr-x | ci/envs/disable_trace.sh | 17 | ||||
-rwxr-xr-x | ci/envs/enable-trace.sh | 60 | ||||
-rwxr-xr-x | ci/test_kvmfornfv.sh | 13 |
4 files changed, 55 insertions, 50 deletions
diff --git a/ci/cyclicTestTrigger.sh b/ci/cyclicTestTrigger.sh index 7a0c2a49b..640a0738a 100755 --- a/ci/cyclicTestTrigger.sh +++ b/ci/cyclicTestTrigger.sh @@ -39,6 +39,15 @@ function verifyGuestImage { fi } +#disabling ftrace and collecting the logs to upload to artifact repository. +function ftrace_disable { + sudo ssh root@${HOST_IP} "sh /root/workspace/scripts/disable_trace.sh" + sudo ssh root@${HOST_IP} "cd /tmp ; mv trace.txt cyclictest_${env}.txt" + mkdir -p $WORKSPACE/build_output/log/kernel_trace + scp root@${HOST_IP}:/tmp/cyclictest_${env}.txt $WORKSPACE/build_output/log/kernel_trace/ + sudo ssh root@${HOST_IP} "cd /tmp ; rm -rf cyclictest_${env}.txt" +} + #Verifying the availability of the host after reboot function connect_host { n=0 @@ -158,6 +167,7 @@ function runPacketForwarding { #Creating a docker image with yardstick installed and Verify the results of cyclictest function runCyclicTest { + ftrace_enable=$1 docker_image_dir=$WORKSPACE/docker_image_build ( cd ${docker_image_dir}; sudo docker build -t kvmfornfv:latest --no-cache=true . ) if [ ${?} -ne 0 ] ; then @@ -183,6 +193,11 @@ function runCyclicTest { copyLogs fi + #Disabling ftrace after completion of executing test cases. + if [ ${ftrace_enable} -eq '1' ]; then + ftrace_disable + fi + #Verifying the results of cyclictest if [ "$testType" == "verify" ];then result=`grep -o '"errors":[^,]*' ${volume}/yardstick.out | awk -F '"' '{print $4}'` diff --git a/ci/envs/disable_trace.sh b/ci/envs/disable_trace.sh index 1b04e62bb..6e1ef15c6 100755 --- a/ci/envs/disable_trace.sh +++ b/ci/envs/disable_trace.sh @@ -2,16 +2,17 @@ set -o xtrace curpwd=`pwd` -TRACE_FILE=$1 -TRACEDIR=/sys/kernel/debug/tracing/ +TRACE_FILE=trace.txt +TRACEDIR=/sys/kernel/debug/tracing -sudo bash -c "echo 0 >$TRACEDIR/tracing_on" +bash -c "echo 0 > $TRACEDIR/tracing_on" sleep 1 -sudo bash -c "cat $TRACEDIR/trace > $TRACE_FILE" -sudo bash -c "echo > $TRACEDIR/set_event" -sudo bash -c "echo > $TRACEDIR/trace" -sudo sysctl kernel.ftrace_enabled=0 -sudo bash -c "echo nop > $TRACEDIR/current_tracer" +bash -c "cat $TRACEDIR/trace > /tmp/$TRACE_FILE" + +bash -c "echo > $TRACEDIR/set_event" +bash -c "echo > $TRACEDIR/trace" +sysctl kernel.ftrace_enabled=0 +bash -c "echo nop > $TRACEDIR/current_tracer" set +o xtrace cd $curpwd diff --git a/ci/envs/enable-trace.sh b/ci/envs/enable-trace.sh index 857f53e0d..e360de137 100755 --- a/ci/envs/enable-trace.sh +++ b/ci/envs/enable-trace.sh @@ -3,8 +3,7 @@ set -o xtrace EVENT=$1 curpwd=`pwd` -TRACEDIR=/sys/kernel/debug/tracing/ -mv /tmp/123.txt /tmp/123.back +TRACEDIR=/sys/kernel/debug/tracing function getcpumask { masks=`lscpu | grep "NUMA node1 CPU(s)"| awk -F ':' '{print \$2}' | sed 's/[[:space:]]//g'` @@ -12,7 +11,7 @@ function getcpumask { last=$(echo ${masks} | cut -f2 -d-) cpumask=0 while [ ${first} -lt ${last} ]; do - cputmp=`echo "ibase=10; obase=16; 2^(${c})" | bc` + cputmp=`echo "ibase=10; obase=16; 2^(${first})" | bc` cpumask=`echo "ibase=16; obase=10; ${cputmp}+${cpumask}" |bc` first=`expr $first + 1` done @@ -22,42 +21,41 @@ function getcpumask { } getcpumask -sudo bash -c "echo $CPUMASK > $TRACEDIR/tracing_cpumask" +bash -c "echo $CPUMASK > $TRACEDIR/tracing_cpumask" #sudo bash -c "echo function > $TRACEDIR/current_tracer" #echo :* > set_event #echo $EVENT:* > set_event -sudo bash -c "echo 1 > $TRACEDIR/events/irq/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/task/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/syscalls/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/kmem/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/fence/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/context_tracking/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/exceptions/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/nmi/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/kmem/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/migrate/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/sock/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/timer/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/sched/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/rcu/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/kvm/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/workqueue/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/power/enable" -sudo bash -c "echo 1 > $TRACEDIR/events/signal/enable" - -sudo bash -c "echo 1 > events/tlb/enable" +bash -c "echo 1 > $TRACEDIR/events/irq/enable" +bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" +bash -c "echo 1 > $TRACEDIR/events/task/enable" +bash -c "echo 1 > $TRACEDIR/events/syscalls/enable" +bash -c "echo 1 > $TRACEDIR/events/kmem/enable" +bash -c "echo 1 > $TRACEDIR/events/fence/enable" +bash -c "echo 1 > $TRACEDIR/events/context_tracking/enable" +bash -c "echo 1 > $TRACEDIR/events/exceptions/enable" +bash -c "echo 1 > $TRACEDIR/events/irq_vectors/enable" +bash -c "echo 1 > $TRACEDIR/events/nmi/enable" +bash -c "echo 1 > $TRACEDIR/events/kmem/enable" +bash -c "echo 1 > $TRACEDIR/events/migrate/enable" +bash -c "echo 1 > $TRACEDIR/events/sock/enable" +bash -c "echo 1 > $TRACEDIR/events/timer/enable" +bash -c "echo 1 > $TRACEDIR/events/sched/enable" +bash -c "echo 1 > $TRACEDIR/events/rcu/enable" +bash -c "echo 1 > $TRACEDIR/events/kvm/enable" +bash -c "echo 1 > $TRACEDIR/events/workqueue/enable" +bash -c "echo 1 > $TRACEDIR/events/power/enable" +bash -c "echo 1 > $TRACEDIR/events/signal/enable" + +bash -c "echo 1 > events/tlb/enable" # Clean original log info -sudo bash -c "echo > $TRACEDIR/trace" -#sudo bash -c "echo function > $TRACEDIR/current_tracer" -sudo sysctl kernel.ftrace_enabled=1 +bash -c "echo > $TRACEDIR/trace" +bash -c "echo function > $TRACEDIR/current_tracer" +sysctl kernel.ftrace_enabled=1 #echo 0 >tracing_on; sleep 1; echo 1 >tracing_on; sleep 20; echo 0 >tracing_on;sleep 1; cat trace >/tmp/123.txt -sudo bash -c "echo 1 >$TRACEDIR/tracing_on" +bash -c "echo 1 >$TRACEDIR/tracing_on" cd $curpwd -#source /home/yjiang5/repo/hostbin/disable_trace.sh set +o xtrace diff --git a/ci/test_kvmfornfv.sh b/ci/test_kvmfornfv.sh index 27419232e..8199bf0e9 100755 --- a/ci/test_kvmfornfv.sh +++ b/ci/test_kvmfornfv.sh @@ -63,7 +63,7 @@ function cyclictest { #Cleaning the environment before running cyclictest through yardstick env_clean #Creating a docker image with yardstick installed and launching ubuntu docker to run yardstick cyclic testcase - if runCyclicTest;then + if runCyclicTest ${ftrace_enable};then cyclictest_result=`expr ${cyclictest_result} + 0` else echo "Test case execution FAILED for ${test_case} environment" @@ -105,13 +105,6 @@ function install_pcm { ' } -function ftrace_disable { - sudo ssh root@${HOST_IP} "sh /root/workspace/scripts/disbale-trace.sh" - sudo ssh root@${HOST_IP} "cd /tmp ; a=\$(ls -rt | tail -1) ; echo \$a ; mv \$a cyclictest_${env}.txt" - sudo mkdir -p $WORKSPACE/build_output/log/kernel_trace - sudo scp root@${HOST_IP}:/tmp/cyclictest_${env}.txt $WORKSPACE/build_output/log/kernel_trace/ -} - #Execution of testcases based on test type and test name from releng. if [ ${test_type} == "verify" ];then HOST_IP="10.10.100.21" @@ -121,11 +114,9 @@ if [ ${test_type} == "verify" ];then for env in ${cyclictest_env_verify[@]} do #Enabling ftrace for kernel debugging. - sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' kvmfornfv_cyclictest_hostenv_guestenv.yaml + sed -i '/host-setup1.sh/a\ \- \"enable-trace.sh\"' $WORKSPACE/tests/kvmfornfv_cyclictest_hostenv_guestenv.yaml #Executing cyclictest through yardstick. cyclictest ${env} - #disabling ftrace and collecting the logs to upload to artifact repository. - ftrace_disable sleep 10 done #Execution of packet forwarding test cases. |