INFO: Update PTL
[vswitchperf.git] / ci / build-vsperf.sh
index 7a16014..b60a7fa 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ LOG_FILE_PREFIX="/tmp/vsperf_build"
 DATE=$(date -u +"%Y-%m-%d_%H-%M-%S")
 BRANCH=${GIT_BRANCH##*/}
 VSPERFENV_DIR="$HOME/vsperfenv"
+RESULTS_ARCHIVE="$HOME/ci_results_archive"
 
 # CI job specific configuration
 # VERIFY - run basic set of TCs with default settings
@@ -54,7 +55,9 @@ TESTCASES_MERGE_VPP=$TESTCASES_VERIFY_VPP
 TESTPARAM_MERGE_VPP=$TESTPARAM_VERIFY_VPP
 # DAILY - run selected TCs for defined packet sizes
 TESTCASES_DAILY='phy2phy_tput back2back phy2phy_tput_mod_vlan phy2phy_scalability pvp_tput pvp_back2back pvvp_tput pvvp_back2back'
+TESTCASES_DAILY_VPP='phy2phy_tput_vpp phy2phy_back2back_vpp pvp_tput_vpp pvp_back2back_vpp pvvp_tput_vpp pvvp_back2back_vpp'
 TESTPARAM_DAILY='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
+TESTPARAM_DAILY_VPP=$TESTPARAM_DAILY
 TESTCASES_SRIOV='pvp_tput'
 TESTPARAM_SRIOV='--test-params TRAFFICGEN_PKT_SIZES=(64,128,512,1024,1518)'
 # check if user config file exists if not then we will use default settings
@@ -77,10 +80,10 @@ fi
 
 # Test report related configuration
 TEST_REPORT_PARTIAL="*_test_report.rst"
-TEST_REPORT_DIR="${WORKSPACE}/docs/results"
+TEST_REPORT_DIR="${WORKSPACE}/docs/testing/developer/devguide/results"
 TEST_REPORT_INDEX="${TEST_REPORT_DIR}/index.rst"
 TEST_REPORT_LINK_OLD="https://wiki.opnfv.org/wiki/vsperf_results"
-TEST_REPORT_FILE="${WORKSPACE}/docs_output/results/index.html"
+TEST_REPORT_FILE="${WORKSPACE}/docs_output/testing_developer_devguide_results/index.html"
 TEST_REPORT_TARBALL="vswitchperf_logs_${DATE}.tar.gz"
 
 if [[ "x${BRANCH}" == "xmaster" ]]; then
@@ -124,18 +127,23 @@ function terminate_vsperf() {
 #   $1 - directory with results
 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
+        if [ ! -e $1 ] ; then
+            printf "    %-70s %-6s\n" "result_${i}" "FAILED"
+            EXIT=$EXIT_TC_FAILED
+        else
+            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
+                    printf "    %-70s %-6s\n" "result_${i}" "OK"
+                fi
+            else
                 printf "    %-70s %-6s\n" "result_${i}" "FAILED"
                 EXIT=$EXIT_TC_FAILED
-            else
-                printf "    %-70s %-6s\n" "result_${i}" "OK"
             fi
-        else
-            printf "    %-70s %-6s\n" "result_${i}" "FAILED"
-            EXIT=$EXIT_TC_FAILED
         fi
     done
 }
@@ -168,9 +176,17 @@ function execute_vsperf() {
             ;;
         *)
             # by default use daily build and upload results to the OPNFV databse
-            TESTPARAM=$TESTPARAM_DAILY
-            TESTCASES=$TESTCASES_DAILY
-            OPNFVPOD="--opnfvpod=$NODE_NAME"
+            if [ "$1" == "VPP" ] ; then
+                TESTPARAM=$TESTPARAM_DAILY_VPP
+                TESTCASES=$TESTCASES_DAILY_VPP
+                # don't report VPP results into testresults DB, until TC name mapping
+                # for VPP tests will be defined
+                #OPNFVPOD="--opnfvpod=$NODE_NAME"
+            else
+                TESTPARAM=$TESTPARAM_DAILY
+                TESTCASES=$TESTCASES_DAILY
+                OPNFVPOD="--opnfvpod=$NODE_NAME"
+            fi
             ;;
     esac
 
@@ -272,7 +288,9 @@ function generate_report() {
 
     # prepare final tarball with all logs...
     tar --exclude "${TEST_REPORT_TARBALL}" -czf "${TEST_REPORT_LOG_DIR}/${TEST_REPORT_TARBALL}" $(find "${TEST_REPORT_LOG_DIR}" -mindepth 1 -maxdepth 1 -type d)
-    # ...and remove original log files
+    # ...and move original log files to the archive directory...
+    find "${TEST_REPORT_LOG_DIR}" -maxdepth 2 -name "results_*" -type d -exec mv \{\} ${RESULTS_ARCHIVE} \;
+    # ...and remove the rest
     find "${TEST_REPORT_LOG_DIR}" -mindepth 1 -maxdepth 1 -type d -exec rm -rf \{\} \;
 
     # clone opnfvdocs repository
@@ -294,6 +312,19 @@ function generate_report() {
     fi
 }
 
+# generates graphs from recent test results
+function generate_and_push_graphs() {
+    # create graphs from results in archive directory
+    ./ci/plot-results.sh "$1" "$2" "$RESULTS_ARCHIVE"
+
+    # push graphs into artifactory
+    if ls *png &> /dev/null ; then
+        gsutil cp *png gs://artifacts.opnfv.org/logs/vswitchperf/intel-pod12/graphs/
+    else
+        echo "Graphs were not created."
+    fi
+}
+
 # pushes test report and logs collected during test execution into artifactory
 function push_results_to_artifactory() {
     # clone releng repository
@@ -396,8 +427,22 @@ function dependencies_check() {
 
 # configure hugepages
 function configure_hugepages() {
-    sudo bash -c "echo 2048 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages"
-    sudo bash -c "echo 0 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages"
+    HP_MAX=8192
+    HP_REQUESTED=3072
+    HP_NR=`cat /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages`
+    HP_FREE=`cat /sys/devices/system/node/node0/hugepages/hugepages-2048kB/free_hugepages`
+    # check if HP must be (re)configured
+    if [ $HP_FREE -lt $HP_REQUESTED ] ; then
+        HP_NR_NEW=$(($HP_NR+($HP_REQUESTED-$HP_FREE)))
+        if [ $HP_NR_NEW -gt $HP_MAX ] ; then
+            HP_NR_NEW=$HP_MAX
+        fi
+        sudo bash -c "echo $HP_NR_NEW > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages"
+    fi
+
+    if [ -f /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages ] ; then
+        sudo bash -c "echo 0 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages"
+    fi
 }
 
 # dump hugepages configuration
@@ -438,7 +483,11 @@ dependencies_check
 initialize_logdir
 
 # configure hugepages
+echo "Configure hugepages"
+echo "==================="
 configure_hugepages
+hugepages_info | grep -v '^--'
+echo
 
 # execute job based on passed parameter
 case $1 in
@@ -488,6 +537,8 @@ case $1 in
         terminate_vsperf
         execute_vsperf OVS_vanilla $1
         terminate_vsperf
+        execute_vsperf VPP $1
+        terminate_vsperf
         execute_vsperf SRIOV $1
         terminate_vsperf
 
@@ -495,6 +546,11 @@ case $1 in
 
         push_results_to_artifactory
 
+        generate_and_push_graphs "$TESTCASES_DAILY" ",OvsDpdkVhost,"
+        generate_and_push_graphs "$TESTCASES_DAILY" ",OvsVanilla,"
+        generate_and_push_graphs "$TESTCASES_DAILY_VPP" ",VppDpdkVhost,"
+        generate_and_push_graphs "$TESTCASES_SRIOV" ",none,"
+
         cleanup
 
         exit $EXIT