From: Luca Toscano Date: Sun, 29 Dec 2019 10:27:50 +0000 (+0000) Subject: test/travis_before_linux.sh: move retry logic to function X-Git-Tag: 2.5.0-alpha2-ci-test-only~1738 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6786fbf847e09bf272d575eeab4dc3eddce2eabf;p=thirdparty%2Fapache%2Fhttpd.git test/travis_before_linux.sh: move retry logic to function 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 --- diff --git a/test/travis_before_linux.sh b/test/travis_before_linux.sh index 8e4543b46dc..f653bcc91c3 100755 --- a/test/travis_before_linux.sh +++ b/test/travis_before_linux.sh @@ -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}"