]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
test/travis_before_linux.sh: move retry logic to function
authorLuca Toscano <elukey@apache.org>
Sun, 29 Dec 2019 10:27:50 +0000 (10:27 +0000)
committerLuca Toscano <elukey@apache.org>
Sun, 29 Dec 2019 10:27:50 +0000 (10:27 +0000)
Move the retry logic to a bash function and restore the -e
failure policy in the script (to have cleaner log traces
in base of build failures).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1872073 13f79535-47bb-0310-9956-ffa450edef68

test/travis_before_linux.sh

index 8e4543b46dcf999ee28e708dcae2d2c95e98930b..f653bcc91c33b1efaad9efebe3997eeaeb110e0f 100755 (executable)
@@ -1,22 +1,33 @@
-#!/bin/bash -x
-if ! test -v SKIP_TESTING; then
-   # Use a rudimental retry workflow as workaround to svn export hanging for minutes.
-   # Travis automatically kills a build if one step takes more than 10 minutes without
-   # reporting any progress.
-   for i in {1..5} 
+#!/bin/bash -xe
+
+# Use a rudimental retry workflow as workaround to svn export hanging for minutes.
+# Travis automatically kills a build if one step takes more than 10 minutes without
+# reporting any progress. 
+function run_svn_export() {
+   local url=$1
+   local dest_dir=$2
+   local max_tries=$3
+
+   # Disable -e to allow fail/retry
+   set +e
+
+   for i in $(seq 1 $max_tries)
    do
-       timeout 60 svn export --force -q https://svn.apache.org/repos/asf/httpd/test/framework/trunk test/perl-framework
+       timeout 60 svn export --force -q $url $dest_dir
        if [ $? -eq 0 ]; then
            break
        else
-           if [ $i -eq 5 ]; then
+           if [ $i -eq $max_tries ]; then
                exit 1
            else
                sleep 120
            fi
        fi
    done
-fi
+
+   # Restore -e behavior after fail/retry
+   set -e
+}
 
 function install_apx() {
     local name=$1
@@ -54,6 +65,11 @@ function install_apx() {
     touch ${prefix}/.revision-is-${revision}
 }
 
+
+if ! test -v SKIP_TESTING; then
+    run_svn_export https://svn.apache.org/repos/asf/httpd/test/framework/trunk test/perl-framework 5
+fi
+
 if test -v APR_VERSION; then
     install_apx apr ${APR_VERSION} "${APR_CONFIG}"
     APU_CONFIG="$APU_CONFIG --with-apr=$HOME/root/apr-${APR_VERSION}"