aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function/common.sh
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2018-10-19 12:21:47 +0200
committerMaciek Konstantynowicz <mkonstan@cisco.com>2018-10-22 21:17:26 +0000
commitd465d9fba33a323703a2bf40c499d74d0f017091 (patch)
tree3678767f68a7d9faf22a93f4be0d5f9b7b807869 /resources/libraries/bash/function/common.sh
parent8e7582edf682a7ba7edcb5ec0a45d00e361ec868 (diff)
Per patch: multiple BMRR calls
This is to reduce sensitivity on testbed unstable performance. Also add topo_cleanupbefore every pybot run to avoid issues with VPP uninstall. TRACE prints are left there to simplify investigation of false positives if/when they happen. Change-Id: I9b0cdcfbbe4aa0735a0596746ac32c9e93af0897 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/bash/function/common.sh')
-rw-r--r--resources/libraries/bash/function/common.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/resources/libraries/bash/function/common.sh b/resources/libraries/bash/function/common.sh
index 8b83ab4e7e..69c70935c7 100644
--- a/resources/libraries/bash/function/common.sh
+++ b/resources/libraries/bash/function/common.sh
@@ -82,6 +82,20 @@ function check_download_dir () {
}
+function cleanup_topo () {
+
+ set -exuo pipefail
+
+ # Variables read:
+ # - WORKING_TOPOLOGY - Path to topology yaml file of the reserved testbed.
+ # - PYTHON_SCRIPTS_DIR - Path to directory holding the reservation script.
+
+ python "${PYTHON_SCRIPTS_DIR}/topo_cleanup.py" -t "${WORKING_TOPOLOGY}"
+ # Not using "|| die" as some callers might want to ignore errors,
+ # e.g. in teardowns, such as unreserve.
+}
+
+
function common_dirs () {
set -exuo pipefail
@@ -178,7 +192,7 @@ function copy_archives () {
# automatically archived to logs.fd.io.
if [[ -n "${WORKSPACE-}" ]]; then
mkdir -p "${WORKSPACE}/archives/" || die "Archives dir create failed."
- cp -r "${ARCHIVE_DIR}"/* "${WORKSPACE}/archives" || die "Copy failed."
+ cp -rf "${ARCHIVE_DIR}"/* "${WORKSPACE}/archives" || die "Copy failed."
fi
}
@@ -310,7 +324,7 @@ function reserve_testbed () {
}
die "Trap attempt failed, unreserve succeeded. Aborting."
}
- python "${PYTHON_SCRIPTS_DIR}/topo_cleanup.py" -t "${topo}" || {
+ cleanup_topo || {
die "Testbed cleanup failed."
}
break
@@ -630,9 +644,9 @@ function untrap_and_unreserve_testbed () {
wt="${WORKING_TOPOLOGY}" # Just to avoid too long lines.
if [[ -z "${wt-}" ]]; then
set -eu
- echo "Testbed looks unreserved already. Trap removal failed before?"
+ warn "Testbed looks unreserved already. Trap removal failed before?"
else
- python "${PYTHON_SCRIPTS_DIR}/topo_cleanup.py" -t "${wt}" || true
+ cleanup_topo || true
python "${PYTHON_SCRIPTS_DIR}/topo_reservation.py" -c -t "${wt}" || {
die "${1:-FAILED TO UNRESERVE, FIX MANUALLY.}" 2
}