From 68bfb0c6bd7ba0c23e665ba4045acbba0e26af02 Mon Sep 17 00:00:00 2001 From: Vanessa Rene Valderrama Date: Tue, 24 Apr 2018 14:58:26 -0500 Subject: [PATCH] Configure tox tests allow serial execution Configuring tox tests to allow serial or parallel execution configurable within JJB by setting the PARALLEL parameter to true or false. Issue: RELENG-912 Change-Id: If2edba598b47484b1708f1e0f3fb96f035511841 Signed-off-by: Vanessa Rene Valderrama --- jjb/lf-python-jobs.yaml | 9 +++++++++ shell/tox-run.sh | 24 ++++++++++++++++++------ 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index fecaeff4..be66e059 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -431,6 +431,8 @@ - comment-added-contains-event: comment-contains-value: recheck$ + parallel: true + ##################### # Job Configuration # ##################### @@ -444,6 +446,13 @@ submodule-recursive: '{submodule-recursive}' choosing-strategy: gerrit + parameters: + - bool: + name: PARALLEL + default: '{parallel}' + description: Tox test type used to configure serial or parallel testing. + + triggers: - gerrit: server-name: '{gerrit-server-name}' diff --git a/shell/tox-run.sh b/shell/tox-run.sh index 7abdeea6..6b451166 100644 --- a/shell/tox-run.sh +++ b/shell/tox-run.sh @@ -28,12 +28,24 @@ if [ -d "/opt/pyenv" ]; then fi set +e # Allow detox to fail so that we can collect the logs in the next step -if [ ! -z "$TOX_ENVS" ]; then - detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log" - detox_status="${PIPESTATUS[0]}" + +PARALLEL="${PARALLEL:-true}" +if [ "${PARALLEL}" = true ]; then + if [ ! -z "$TOX_ENVS" ]; then + detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log" + tox_status="${PIPESTATUS[0]}" + else + detox | tee -a "$ARCHIVE_TOX_DIR/detox.log" + tox_status="${PIPESTATUS[0]}" + fi else - detox | tee -a "$ARCHIVE_TOX_DIR/detox.log" - detox_status="${PIPESTATUS[0]}" + if [ ! -z "$TOX_ENVS" ]; then + tox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/tox.log" + tox_status="${PIPESTATUS[0]}" + else + tox | tee -a "$ARCHIVE_TOX_DIR/tox.log" + tox_status="${PIPESTATUS[0]}" + fi fi # Disable SC2116 as we want to echo a space separated list of TOX_ENVS @@ -46,4 +58,4 @@ set -e # Logs collected so re-enable echo "Completed tox runs." -test "$detox_status" -eq 0 || exit "$detox_status" +test "$tox_status" -eq 0 || exit "$tox_status" -- 2.16.6