make graph node variant can be configured from gerrit trigger
[csit.git] / resources / libraries / bash / function / common.sh
index 8f2e888..f724e53 100644 (file)
@@ -116,16 +116,16 @@ function activate_virtualenv () {
     env_dir="${root_path}/env"
     req_path=${2-$CSIT_DIR/requirements.txt}
     rm -rf "${env_dir}" || die "Failed to clean previous virtualenv."
-    pip3 install --upgrade virtualenv || {
+    pip3 install virtualenv==20.0.20 || {
         die "Virtualenv package install failed."
     }
-    virtualenv --python=$(which python3) "${env_dir}" || {
+    virtualenv --no-download --python=$(which python3) "${env_dir}" || {
         die "Virtualenv creation for $(which python3) failed."
     }
     set +u
     source "${env_dir}/bin/activate" || die "Virtualenv activation failed."
     set -u
-    pip3 install --upgrade -r "${req_path}" || {
+    pip3 install -r "${req_path}" || {
         die "Requirements installation failed."
     }
     # Most CSIT Python scripts assume PYTHONPATH is set and exported.
@@ -524,6 +524,19 @@ function get_test_tag_string () {
         cmd=("grep" "-oP" '\S*'"${trigger}"'\S*\s\K.+$') || die "Unset trigger?"
         # On parsing error, TEST_TAG_STRING probably stays empty.
         TEST_TAG_STRING=$("${cmd[@]}" <<< "${comment}") || true
+        if [[ -n "${TEST_TAG_STRING-}" ]]; then
+            test_tag_array=(${TEST_TAG_STRING})
+            if [[ "${test_tag_array[0]}" == "icl" ]]; then
+                export GRAPH_NODE_VARIANT="icl"
+                TEST_TAG_STRING="${test_tag_array[@]:1}" || true
+            elif [[ "${test_tag_array[0]}" == "skx" ]]; then
+                export GRAPH_NODE_VARIANT="skx"
+                TEST_TAG_STRING="${test_tag_array[@]:1}" || true
+            elif [[ "${test_tag_array[0]}" == "hsw" ]]; then
+                export GRAPH_NODE_VARIANT="hsw"
+                TEST_TAG_STRING="${test_tag_array[@]:1}" || true
+            fi
+        fi
     fi
 }
 
@@ -710,6 +723,7 @@ function select_tags () {
     # Variables read:
     # - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
     # - TEST_CODE - String affecting test selection, usually jenkins job name.
+    # - DUT - CSIT test/ subdirectory, set while processing tags.
     # - TEST_TAG_STRING - String selecting tags, from gerrit comment.
     #   Can be unset.
     # - TOPOLOGIES_DIR - Path to existing directory with available tpologies.
@@ -769,17 +783,33 @@ function select_tags () {
         # Select specific performance tests based on jenkins job type variable.
         *"ndrpdr-weekly"* )
             readarray -t test_tag_array <<< $(sed 's/ //g' \
-                ${tfd}/mlr-weekly-${NODENESS}-${FLAVOR}.md |
+                ${tfd}/mlr_weekly/${DUT}-${NODENESS}-${FLAVOR}.md |
                 eval ${sed_nics_sub_cmd}) || die
             ;;
         *"mrr-daily"* )
             readarray -t test_tag_array <<< $(sed 's/ //g' \
-                ${tfd}/mrr-daily-${NODENESS}-${FLAVOR}.md |
+                ${tfd}/mrr_daily/${DUT}-${NODENESS}-${FLAVOR}.md |
                 eval ${sed_nics_sub_cmd}) || die
             ;;
         *"mrr-weekly"* )
             readarray -t test_tag_array <<< $(sed 's/ //g' \
-                ${tfd}/mrr-weekly-${NODENESS}-${FLAVOR}.md |
+                ${tfd}/mrr_weekly/${DUT}-${NODENESS}-${FLAVOR}.md |
+                eval ${sed_nics_sub_cmd}) || die
+            ;;
+        *"report-iterative"* )
+            test_sets=(${TEST_TAG_STRING//:/ })
+            # Run only one test set per run
+            report_file=${test_sets[0]}.md
+            readarray -t test_tag_array <<< $(sed 's/ //g' \
+                ${tfd}/report_iterative/${NODENESS}-${FLAVOR}/${report_file} |
+                eval ${sed_nics_sub_cmd}) || die
+            ;;
+        *"report-coverage"* )
+            test_sets=(${TEST_TAG_STRING//:/ })
+            # Run only one test set per run
+            report_file=${test_sets[0]}.md
+            readarray -t test_tag_array <<< $(sed 's/ //g' \
+                ${tfd}/report_coverage/${NODENESS}-${FLAVOR}/${report_file} |
                 eval ${sed_nics_sub_cmd}) || die
             ;;
         * )