From 4e43dd2870065c20361de0d7903f1320e7b2c809 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Fri, 26 Feb 2016 00:23:03 -0800 Subject: [PATCH] build: increase retry time for make testfront to 5 --- .ci/common.sh | 27 +++++++++++++++++++++++++++ .ci/script.sh | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.ci/common.sh b/.ci/common.sh index 0ee4bd104..4d84291d5 100644 --- a/.ci/common.sh +++ b/.ci/common.sh @@ -30,6 +30,33 @@ travis_retry() { return $result } +retry_cmd() { + local result=0 + local count=1 + set +e + + retry_cnt=$1 + shift 1 + + while [ $count -le ${retry_cnt} ]; do + [ $result -ne 0 ] && { + echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of ${retry_cnt}${ANSI_RESET}\n" >&2 + } + "$@" + result=$? + [ $result -eq 0 ] && break + count=$(($count + 1)) + sleep 1 + done + + [ $count -gt ${retry_cnt} ] && { + echo -e "\n${ANSI_RED}The command \"$@\" failed ${retry_cnt} times.${ANSI_RESET}\n" >&2 + } + + set -e + return $result +} + export PATH=$PWD/bin:$PATH export PATH=$PATH:${TRAVIS_BUILD_DIR}/install/bin if [ -f ${TRAVIS_BUILD_DIR}/install/bin/luarocks ]; then diff --git a/.ci/script.sh b/.ci/script.sh index 64be8cb4a..a5233bad1 100755 --- a/.ci/script.sh +++ b/.ci/script.sh @@ -5,7 +5,7 @@ source "${CI_DIR}/common.sh" travis_retry make fetchthirdparty make all -travis_retry make testfront +retry_cmd 6 make testfront set +o pipefail luajit $(which luacheck) --no-color -q frontend | tee ./luacheck.out test $(grep Total ./luacheck.out | awk '{print $2}') -le 63