diff options
Diffstat (limited to 'ci/envs')
-rwxr-xr-x | ci/envs/disable_trace.sh | 17 | ||||
-rwxr-xr-x | ci/envs/enable-trace.sh | 60 | ||||
-rwxr-xr-x | ci/envs/host-config | 27 | ||||
-rw-r--r-- | ci/envs/packet_forwarding.sh | 174 | ||||
-rwxr-xr-x | ci/envs/utils.sh | 14 |
5 files changed, 249 insertions, 43 deletions
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/envs/host-config b/ci/envs/host-config index 99cbb3773..4a5d1b5a2 100755 --- a/ci/envs/host-config +++ b/ci/envs/host-config @@ -21,7 +21,7 @@ pcm_memory=/root/pcm/pcm-memory.x # Isolated cpus for nfv, must be given as a range '-' and Numa node1 CPU's should be considered host_isolcpus=`lscpu | grep "NUMA node1 CPU(s)"| awk -F ':' '{print \$2}' | sed 's/[[:space:]]//g'` first=$(echo ${host_isolcpus} | cut -f1 -d-) -last=$(echo ${host_isolcpus} | cut -f2 -d-) +last=$(echo ${host_isolcpus} | cut -f2 -d- | cut -d',' -f1 ) # Bind cpus from host_isolcpus range for QEMU processor threads i=0 @@ -35,8 +35,8 @@ done stress_isolcpus=${first}-${last} echo "Stress tool runs on $stress_isolcpus" -#Tar the log files generated during testcase execution. -function err_exit { +#Tar the log files generated during testcase execution and exit. +function test_exit { exitCode=$1 cd $WORKSPACE/build_output/ if [ -d log ];then @@ -55,3 +55,24 @@ function copyLogs { sudo ssh root@${HOST_IP} "cd /root;rm -rf MBWInfo MBWInfo.tar.gz" } +function packet_fwd_logs { + #Tar and copy logs for uploading to artifacts repository + echo "Copying Log files from Node to Jump Server" + mkdir -p $WORKSPACE/build_output/log/packet_fwd + scp -r root@${HOST_IP}:/tmp/packet_fwd_logs $WORKSPACE/build_output/log/packet_fwd + #removing collected logs on the node after copying. + sudo ssh root@${HOST_IP} "cd /tmp;rm -rf packet_fwd_logs" +} + +function packet_fwd_exit { + exitCode=$1 + TIMESTAMP=$(date -u +"%Y-%m-%d_%H-%M-%S") + cd $WORKSPACE/build_output/ + if [ -d log ];then + tar -czvf log-${TIMESTAMP}.tar.gz log + echo "Uploading packet forwarding logs and results" + gsutil cp -r log-*.tar.gz gs://artifacts.opnfv.org/kvmfornfv/packet_fwd_${TIMESTAMP} > $WORKSPACE/build_output/gsutil.log 2>&1 + echo "http://artifacts.opnfv.org/kvmfornfv/packet_fwd_${TIMESTAMP}" + fi + exit $exitCode +} diff --git a/ci/envs/packet_forwarding.sh b/ci/envs/packet_forwarding.sh new file mode 100644 index 000000000..ec399c6ab --- /dev/null +++ b/ci/envs/packet_forwarding.sh @@ -0,0 +1,174 @@ +#!/bin/bash +JOB_TYPE=$1 +QEMURPM_VERSION=$2 +HOME='/home/jenkins' +VSPERF="${HOME}/vswitchperf" +LOG_FILE_PREFIX="/tmp/vsperf_build" +VSPERF_BIN='./vsperf' +DATE=$(date -u +"%Y-%m-%d_%H-%M-%S") +VSPERFENV_DIR="$HOME/vsperfenv" +TEST_REPORT_LOG_DIR="/tmp/packet_fwd_logs" +EXIT=0 +EXIT_TC_FAILED=1 + +# DAILY - run selected TCs for defined packet sizes +TESTCASES_DAILY='phy2phy_tput phy2phy_tput_mod_vlan pvp_tput' +TESTPARAM_DAILY='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)' +TESTCASES_SRIOV='pvp_tput' +TESTPARAM_SRIOV='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)' + +#mounting shared directory for collecting ixia test results. +shared_dir=$(sudo mount | grep ixia_results) +if [ -z "$shared_dir" ]; then + echo "mounting shared directory for results" + sudo mount -t cifs //10.10.100.6/ixia_results/kvm4nfv_ci /mnt/ixia_results/kvm4nfv_ci -o password=kvm4nfv! -o username=kvm4nfv,file_mode=0777,dir_mode=0777,nounix +else + echo "shared directory is already mounted for results" +fi + +# check if user config file exists if not then we will use default settings +if [ -f $HOME/vsperf.conf ] ; then + CONF_FILE="--conf-file ${HOME}/vsperf.conf" + else + echo "configuration file not found on the test node" + echo "Using configuration file available in kvmfornfv repo" + CONF_FILE="--conf-file /root/workspace/scripts/vsperf.conf" +fi + +# check if sriov config file exists if not then we will use default settings +if [ -f $HOME/vsperf.conf.sriov ] ; then + CONF_FILE_SRIOV="--conf-file ${HOME}/vsperf.conf.sriov" + else + echo "SRIOV configuration file not found on the node" + echo "Using SRIOV configuration file available in kvmfornfv repo" + CONF_FILE="--conf-file /root/workspace/scripts/vsperf.conf.sriov" +fi + +function install_vsperf() { + echo "Installing vsperf....." + ( cd $VSPERF/systems ; ./build_base_machine.sh ) +} + +#Install kvmfornfv built qemu for launching guest vm. +function install_qemu() { + echo "removing existing qemu packages and installing kvmfornfv built qemu" + ( cd /root/workspace/scripts ; ./host-install-qemu.sh ) +} + +function print_results() { + for i in $TESTCASES ; do + RES_FILE=`ls -1 $1 | egrep "result_${i}_[0-9a-zA-Z\-]+.csv"` + + if [ "x$RES_FILE" != "x" -a -e "${1}/${RES_FILE}" ]; then + if grep ^FAILED "${1}/${RES_FILE}" &> /dev/null ; then + printf " %-70s %-6s\n" "result_${i}" "FAILED" + EXIT=$EXIT_TC_FAILED + else + echo "--------------------------------------------------------------" + printf " %-50s %-6s\n" "result_${i}" "OK" + echo "--------------------------------------------------------------" + fi + else + echo "------------------------------------------------------------------" + printf " %-50s %-6s\n" "result_${i}" "FAILED" + echo "------------------------------------------------------------------" + EXIT=$EXIT_TC_FAILED + fi + done +} + +function execute_vsperf() { + # figure out list of TCs and execution parameters + case $2 in + "daily") + TESTPARAM=$TESTPARAM_DAILY + TESTCASES=$TESTCASES_DAILY + ;; + *) + echo "No vsperf test cases implemented for this job type" + ;; + esac + + # execute testcases + echo -e "\nExecution of VSPERF for $1" + DATE_SUFFIX=$(date -u +"%Y-%m-%d_%H-%M-%S") + source "$VSPERFENV_DIR"/bin/activate + case $1 in + "SRIOV") + # use SRIOV specific TCs and configuration + TESTPARAM=$TESTPARAM_SRIOV + TESTCASES=$TESTCASES_SRIOV + # figure out log file name + LOG_SUBDIR="SRIOV" + LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log" + echo " $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE" + $VSPERF_BIN --vswitch none --vnf QemuPciPassthrough $CONF_FILE_SRIOV $TESTPARAM $TESTCASES &> $LOG_FILE + ;; + *) + # figure out log file name + LOG_SUBDIR="OvsDpdkVhost" + LOG_FILE="${LOG_FILE_PREFIX}_${LOG_SUBDIR}_${DATE_SUFFIX}.log" + echo " $VSPERF_BIN $OPNFVPOD --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES > $LOG_FILE" + echo "daily test cases started" + cd $HOME/vswitchperf + $VSPERF_BIN --list + $VSPERF_BIN --vswitch OvsDpdkVhost --vnf QemuDpdkVhostUser $CONF_FILE $TESTPARAM $TESTCASES &>> $LOG_FILE + ;; + esac + # evaluation of results + echo -e "\nResults for $1" + RES_DIR="/$(grep "Creating result directory" $LOG_FILE | cut -d'/' -f2-)" + if [[ "/" == "${RES_DIR}" ]] ; then + echo "FAILURE: Results are not available." + echo "-------------------------------------------------------------------" + cat $LOG_FILE + echo "-------------------------------------------------------------------" + exit $EXIT_NO_RESULTS + else + print_results "${RES_DIR}" + if [ $(($EXIT & $EXIT_TC_FAILED)) -gt 0 ] ; then + echo "-------------------------------------------------------------------" + cat $LOG_FILE + echo "-------------------------------------------------------------------" + fi + fi + # show detailed result figures + for md_file in $(grep '\.md"$' $LOG_FILE | cut -d'"' -f2); do + # TC resut file header + echo -e "\n-------------------------------------------------------------------" + echo -e " $md_file" + echo -e "-------------------------------------------------------------------\n" + # TC details + sed -n '/^- Test ID/,/Bidirectional/{/Packet size/b;p;/Bidirectional/q};/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file + # TC results + sed -n '/Results\/Metrics Collected/,/Statistics collected/{/^$/p;/^|/p}' $md_file | grep -v "Unknown" | cat -s + done + + # copy logs into dedicated directory + mkdir -p ${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR} + [ -f "$LOG_FILE" ] && cp -a "${LOG_FILE}" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null + [ -d "$RES_DIR" ] && cp -ar "$RES_DIR" "${TEST_REPORT_LOG_DIR}/${LOG_SUBDIR}" &> /dev/null +} + +#Install vsperf and set up the environment +install_vsperf + +#Install kvmfornfv built qemu rpm +install_qemu + +# execute job based on passed parameter +case $1 in + "daily") + echo "================" + echo "VSPERF daily job" + echo "================" + execute_vsperf OVS_with_DPDK_and_vHost_User $1 + execute_vsperf SRIOV $1 + exit $EXIT + ;; + *) + echo "test cases not implemented for this job type" +esac + +exit $EXIT + diff --git a/ci/envs/utils.sh b/ci/envs/utils.sh index 89df273ac..c2c0f85a6 100755 --- a/ci/envs/utils.sh +++ b/ci/envs/utils.sh @@ -39,4 +39,16 @@ function getQemuVersion { fi echo ${RPMVERSION} } - +#Check RPM names to continue the execution of testcases +function checkRPMNames { + rpm_dir="/root/workspace/rpm" + if [ -d "$WORKSPACE" ];then + cd $WORKSPACE/build_output 2>/dev/null;RPMCOUNT=`ls kvmfornfv-* 2>/dev/null | wc -l` + if [ $RPMCOUNT -ne 0 ];then + echo "Testcases are not executed for apex_build" + exit 0 + else + echo "Continue test execution" + fi + fi +} |