Configure tox tests allow serial execution 12/10212/8
authorVanessa Rene Valderrama <vvalderrama@linuxfoundation.org>
Tue, 24 Apr 2018 19:58:26 +0000 (14:58 -0500)
committerVanessa Rene Valderrama <vvalderrama@linuxfoundation.org>
Wed, 2 May 2018 19:30:07 +0000 (14:30 -0500)
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 <vvalderrama@linuxfoundation.org>
jjb/lf-python-jobs.yaml
shell/tox-run.sh

index fecaeff..be66e05 100644 (file)
       - comment-added-contains-event:
           comment-contains-value: recheck$
 
+    parallel: true
+
     #####################
     # Job Configuration #
     #####################
           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}'
index 7abdeea..6b45116 100644 (file)
@@ -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"