From d8794950c06238fce8cbf161e83d88c7d19bcd77 Mon Sep 17 00:00:00 2001 From: cytopia Date: Tue, 18 Dec 2018 14:40:41 +0100 Subject: [PATCH] Disable phpRedmin CI tests for PHP 5.3 and PHP 5.4 --- .tests/intra-tests/vendor-phpredmin.sh | 69 ++++++++++++++++++++------ 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/.tests/intra-tests/vendor-phpredmin.sh b/.tests/intra-tests/vendor-phpredmin.sh index 7aa23a4a..9ced6e7f 100755 --- a/.tests/intra-tests/vendor-phpredmin.sh +++ b/.tests/intra-tests/vendor-phpredmin.sh @@ -5,6 +5,8 @@ set -u set -o pipefail +DISABLED_VERSIONS=("5.2" "5.3" "5.4") + # # NOTE: Parsing curl to tac to circumnvent "failed writing body" # https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body @@ -41,32 +43,67 @@ else fi +### +### Get current PHP version +### + +printf "[TEST] Get PHP version" +# 1st Try +if ! PHP_VERSION="$( curl -sS localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+\)' | grep -Eo '\([.0-9]+\)' | grep -Eo '[0-9]+\.[0-9]+' )"; then + # 2nd Try + sleep 1 + if ! PHP_VERSION="$( curl -sS localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+\)' | grep -Eo '\([.0-9]+\)' | grep -Eo '[0-9]+\.[0-9]+' )"; then + # 3rd Try + sleep 1 + if ! PHP_VERSION="$( curl -sS localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+\)' | grep -Eo '\([.0-9]+\)' | grep -Eo '[0-9]+\.[0-9]+' )"; then + printf "\r[FAIL] Get PHP version\n" + curl -sS localhost/index.php | tac | tac | grep -Eo 'PHP.*?\([.0-9]+\)' || true + exit 1 + else + printf "\r[OK] Get PHP version (3 rounds): %s\n" "${PHP_VERSION}" + fi + else + printf "\r[OK] Get PHP version (2 rounds): %s\n" "${PHP_VERSION}" + fi +else + printf "\r[OK] Get PHP version (1 round): %s\n" "${PHP_VERSION}" +fi + + +### +### Ensure only to check against desired versions +### + +if [[ ! ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then + ### ### Ensure PHPRedmin works in subdirectory ### -URL="/vendor/phpredmin/public/index.php/welcome/info/0/0" + URL="/vendor/phpredmin/public/index.php/welcome/info/0/0" -printf "[TEST] Fetch ${URL}" -# 1st Try -if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then - # 2nd Try - sleep 1 + printf "[TEST] Fetch ${URL}" + # 1st Try if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then - # 3rd Try + # 2nd Try sleep 1 if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then - printf "\r[FAIL] Fetch ${URL}\n" - curl -sS localhost/${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)" || true - curl -sS localhost/${URL} || true - curl -sSI localhost/${URL} || true - exit 1 + # 3rd Try + sleep 1 + if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then + printf "\r[FAIL] Fetch ${URL}\n" + curl -sS localhost/${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)" || true + curl -sS localhost/${URL} || true + curl -sSI localhost/${URL} || true + exit 1 + else + printf "\r[OK] Fetch ${URL} (3 rounds)\n" + fi else - printf "\r[OK] Fetch ${URL} (3 rounds)\n" + printf "\r[OK] Fetch ${URL} (2 rounds)\n" fi else - printf "\r[OK] Fetch ${URL} (2 rounds)\n" + printf "\r[OK] Fetch ${URL} (1 round)\n" fi -else - printf "\r[OK] Fetch ${URL} (1 round)\n" + fi