From caafc261d5437ac132a7727e9bf178cedab2b483 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 17 Dec 2019 09:48:49 +0100 Subject: [PATCH] Avoid checking the same extensions more than once --- scripts/travisci-test-extensions | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scripts/travisci-test-extensions b/scripts/travisci-test-extensions index 38fc6ce..9c1bdbd 100755 --- a/scripts/travisci-test-extensions +++ b/scripts/travisci-test-extensions @@ -17,6 +17,7 @@ fi . "${TRAVIS_BUILD_DIR}/scripts/common" +ALREADY_TESTED_EXTENSIONS='' # Get the docker image ID for a PHP extension and a PHP version # @@ -95,12 +96,13 @@ testNewExtensionLine () { if test $# -lt 2; then printf 'Missing PHP version list for the new extension %s\n' "${1:-}" testNewExtensionLine_rc=1 - else + elif ! stringInList "$1" "$ALREADY_TESTED_EXTENSIONS"; then printf '### TESTING NEW EXTENSION %s ###\n' "${1}" if test -n "$(printf '%s' "${1}" | sed -E 's/^[a-z][a-z0-9\-\_\.]+$//')"; then printf ' INVALID PHP EXTENSION NAME: %s\n' "${1}" >&2 testNewExtensionLine_rc=1 else + ALREADY_TESTED_EXTENSIONS="$ALREADY_TESTED_EXTENSIONS $1" testNewExtensionLine_extension="${1}" while test $# -ge 2; do shift @@ -203,12 +205,15 @@ testExtensionsFromMessage () { fi IFS=' ' for TEST_EXTENSION in $TEST_EXTENSIONS; do - printf '### TESTING EXTENSION %s ###\n' "$TEST_EXTENSION" - for TEST_PHPVERSION in $(getAllPHPVersionsFor $TEST_EXTENSION); do - if ! testExtension "$TEST_EXTENSION" "$TEST_PHPVERSION"; then - testExtensionsFromMessage_result=1 - fi - done + if ! stringInList "$TEST_EXTENSION" "$ALREADY_TESTED_EXTENSIONS"; then + ALREADY_TESTED_EXTENSIONS="$ALREADY_TESTED_EXTENSIONS $TEST_EXTENSION" + printf '### TESTING EXTENSION %s ###\n' "$TEST_EXTENSION" + for TEST_PHPVERSION in $(getAllPHPVersionsFor $TEST_EXTENSION); do + if ! testExtension "$TEST_EXTENSION" "$TEST_PHPVERSION"; then + testExtensionsFromMessage_result=1 + fi + done + fi done done resetIFS