Allow to disable certain version for vendor checks

This commit is contained in:
cytopia 2019-02-10 12:29:42 +01:00
parent 25e94d28cb
commit 598358e99e
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
5 changed files with 94 additions and 86 deletions

View File

@ -5,8 +5,7 @@ set -u
set -o pipefail
DISABLED_VERSIONS=("7.4")
DISABLED_VERSIONS=("7.4" "8.0")
#
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
@ -46,81 +45,84 @@ fi
###
### https://stackoverflow.com/a/15394738
###
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP ${PHP_VERSION}\n"
exit 0
fi
if [[ ! ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
###
### Xdebug available
###
printf "[TEST] Xdebug available"
# 1st Try
###
### Xdebug available
###
printf "[TEST] Xdebug available"
# 1st Try
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
# 2nd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
# 2nd Try
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep -q 'xdebug\.remote_enable'; then
printf "\r[FAIL] Xdebug available\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug available (3 rounds)\n"
fi
printf "\r[FAIL] Xdebug available\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug available (2 rounds)\n"
printf "\r[OK] Xdebug available (3 rounds)\n"
fi
else
printf "\r[OK] Xdebug available (1 round)\n"
printf "\r[OK] Xdebug available (2 rounds)\n"
fi
else
printf "\r[OK] Xdebug available (1 round)\n"
fi
###
### Xdebug default disabled
###
printf "[TEST] Xdebug default disabled"
# 1st Try
###
### Xdebug default disabled
###
printf "[TEST] Xdebug default disabled"
# 1st Try
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
# 2nd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
# 2nd Try
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_enable' | grep -Eq 'Off.+Off'; then
printf "\r[FAIL] Xdebug default disabled\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug default disabled (3 rounds)\n"
fi
printf "\r[FAIL] Xdebug default disabled\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug default disabled (2 rounds)\n"
printf "\r[OK] Xdebug default disabled (3 rounds)\n"
fi
else
printf "\r[OK] Xdebug default disabled (1 round)\n"
printf "\r[OK] Xdebug default disabled (2 rounds)\n"
fi
else
printf "\r[OK] Xdebug default disabled (1 round)\n"
fi
###
### Xdebug autostart disabled
###
printf "[TEST] Xdebug autostart disabled"
# 1st Try
###
### Xdebug autostart disabled
###
printf "[TEST] Xdebug autostart disabled"
# 1st Try
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_autostart' | grep -Eq 'Off.+Off'; then
# 2nd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_autostart' | grep -Eq 'Off.+Off'; then
# 2nd Try
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_autostart' | grep -Eq 'Off.+Off'; then
# 3rd Try
sleep 1
if ! curl -sS localhost/info_php.php | tac | tac | grep 'xdebug\.remote_autostart' | grep -Eq 'Off.+Off'; then
printf "\r[FAIL] Xdebug autostart disabled\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug autostart disabled (3 rounds)\n"
fi
printf "\r[FAIL] Xdebug autostart disabled\n"
curl -sS localhost/info_php.php | tac | tac | grep 'xdebug' || true
exit 1
else
printf "\r[OK] Xdebug autostart disabled (2 rounds)\n"
printf "\r[OK] Xdebug autostart disabled (3 rounds)\n"
fi
else
printf "\r[OK] Xdebug autostart disabled (1 round)\n"
printf "\r[OK] Xdebug autostart disabled (2 rounds)\n"
fi
else
printf "\r[OK] Xdebug autostart disabled (1 round)\n"
fi

View File

@ -5,11 +5,14 @@ set -u
set -o pipefail
DISABLED_VERSIONS_MONGO=("7.3")
#
# NOTE: Parsing curl to tac to circumnvent "failed writing body"
# https://stackoverflow.com/questions/16703647/why-curl-return-and-error-23-failed-writing-body
#
###
### Get current PHP version
###
@ -150,14 +153,19 @@ fi
###
### Test Adminer MongoDB login
### Ensure only to check against desired versions
###
DISABLED_VERSIONS=("7.3")
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
echo "Skipping Adminer Mongo login test for PHP 7.3"
if [[ ${DISABLED_VERSIONS_MONGO[*]} =~ ${PHP_VERSION} ]]; then
echo "Skipping Adminer Mongo login test for PHP ${PHP_VERSION}"
exit 0
fi
###
### Test Adminer MongoDB login
###
printf "[TEST] Adminer Mongo login"
# 1st Try
if ! curl -sS "localhost${URL}?mongo=mongo&username=" | tac | tac | grep -Eiq "Database.+Collation.+Tables"; then

View File

@ -5,8 +5,6 @@ set -u
set -o pipefail
# There's currently an Issue with PHP 7.3, Xdebug and phpMyAdmin. It just segfaults,
# so I will remove it from the checks.
DISABLED_VERSIONS=("")
#

View File

@ -5,9 +5,7 @@ set -u
set -o pipefail
# There's currently an Issue with PHP 7.3, Xdebug and phpMyAdmin. It just segfaults,
# so I will remove it from the checks.
DISABLED_VERSIONS=("")
DISABLED_VERSIONS=("8.0")
#
# NOTE: Parsing curl to tac to circumnvent "failed writing body"

View File

@ -70,40 +70,42 @@ else
fi
###
### Ensure only to check against desired versions
###
if [[ ! ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
if [[ ${DISABLED_VERSIONS[*]} =~ ${PHP_VERSION} ]]; then
printf "[SKIP] Skipping all checks for PHP ${PHP_VERSION}\n"
exit 0
fi
###
### Ensure PHPRedmin works in subdirectory
###
URL="/vendor/phpredmin/public/index.php/welcome/info/0/0"
printf "[TEST] Fetch ${URL}"
# 1st Try
###
### Ensure PHPRedmin works in subdirectory
###
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
if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then
# 2nd Try
# 3rd Try
sleep 1
if [ "$(curl -sS localhost${URL} | tac | tac | grep -Ec "(Version:)|(Mode:)|(Role:)|(OS:)|(Uptime:)")" != "5" ]; then
# 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
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} (2 rounds)\n"
printf "\r[OK] Fetch ${URL} (3 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (1 round)\n"
printf "\r[OK] Fetch ${URL} (2 rounds)\n"
fi
else
printf "\r[OK] Fetch ${URL} (1 round)\n"
fi