Introduce EXPECTED_FAILING
[csit.git] / resources / libraries / bash / function / common.sh
index 08e916f..96c7940 100644 (file)
@@ -107,11 +107,6 @@ function activate_virtualenv () {
     # Functions called:
     # - die - Print to stderr and exit.
 
-    # TODO: Do we want the callers to be able to set the env dir name?
-    # TODO: + In that case, do we want to support env switching?
-    # TODO:   + In that case we want to make env_dir global.
-    # TODO: Do we want the callers to override PYTHONPATH loaction?
-
     root_path="${1-$CSIT_DIR}"
     env_dir="${root_path}/env"
     req_path=${2-$CSIT_DIR/requirements.txt}
@@ -156,7 +151,6 @@ function check_download_dir () {
     set -exuo pipefail
 
     # Fail if there are no files visible in ${DOWNLOAD_DIR}.
-    # TODO: Do we need this as a function, if it is (almost) a one-liner?
     #
     # Variables read:
     # - DOWNLOAD_DIR - Path to directory pybot takes the build to test from.
@@ -524,6 +518,10 @@ function reserve_and_cleanup_testbed () {
     # Variables read:
     # - TOPOLOGIES - Array of paths to topology yaml to attempt reservation on.
     # - PYTHON_SCRIPTS_DIR - Path to directory holding the reservation script.
+    # - BUILD_TAG - Any string suitable as filename, identifying
+    #   test run executing this function. May be unset.
+    # - BUILD_URL - Any string suitable as URL, identifying
+    #   test run executing this function. May be unset.
     # Variables set:
     # - TOPOLOGIES - Array of paths to topologies, with failed cleanups removed.
     # - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
@@ -535,7 +533,10 @@ function reserve_and_cleanup_testbed () {
     while [[ ${TOPOLOGIES[@]} ]]; do
         for topo in "${TOPOLOGIES[@]}"; do
             set +e
-            python "${PYTHON_SCRIPTS_DIR}/topo_reservation.py" -t "${topo}"
+            scrpt="${PYTHON_SCRIPTS_DIR}/topo_reservation.py"
+            opts=("-t" "${topo}" "-r" "${BUILD_TAG:-Unknown}")
+            opts+=("-u" "${BUILD_URL:-Unknown}")
+            python "${scrpt}" "${opts[@]}"
             result="$?"
             set -e
             if [[ "${result}" == "0" ]]; then
@@ -612,11 +613,11 @@ function run_pybot () {
     # - die - Print to stderr and exit.
 
     all_options=("--outputdir" "${ARCHIVE_DIR}" "${PYBOT_ARGS[@]}")
+    all_options+=("--noncritical" "EXPECTED_FAILING")
     all_options+=("${EXPANDED_TAGS[@]}")
 
     pushd "${CSIT_DIR}" || die "Change directory operation failed."
     set +e
-    # TODO: Make robot tests not require "$(pwd)" == "${CSIT_DIR}".
     pybot "${all_options[@]}" "${GENERATED_DIR}/tests/"
     PYBOT_EXIT_STATUS="$?"
     set -e