docker-php-extension-installer/scripts/test-installversion

28 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/bin/sh
# Let's set a sane environment
set -o errexit
set -o nounset
WANTED_VERSION="${1:-}"
WANTED_VERSION_BASE="${1#^}"
WANTED_VERSION_BASE="${WANTED_VERSION_BASE%@*}"
INSTALLME=xdebug
if test -n "$WANTED_VERSION"; then
2021-08-11 09:43:38 +00:00
INSTALLME="$INSTALLME-$1"
fi
2021-01-14 16:05:23 +00:00
CI=true ./install-php-extensions "$INSTALLME"
INSTALLED_VERSION="$(php --ri xdebug | grep -Ei 'Version\s*=>\s*' | sed -E 's/^.*?=>\s*//')"
if test -z "$WANTED_VERSION"; then
2021-08-11 09:43:38 +00:00
printf 'Installing the default version worked (we installed version %s)\n' "$INSTALLED_VERSION"
elif test "$WANTED_VERSION" = "$INSTALLED_VERSION"; then
2021-08-11 09:43:38 +00:00
printf 'Installing specific version %s worked\n' "$WANTED_VERSION"
elif test "$WANTED_VERSION" != "$WANTED_VERSION_BASE" && test "${INSTALLED_VERSION#$WANTED_VERSION_BASE.}" != "$INSTALLED_VERSION"; then
2021-08-11 09:43:38 +00:00
printf 'Installing version compatible with %s worked (we installed version %s)\n' "$WANTED_VERSION" "$INSTALLED_VERSION"
else
2021-08-11 09:43:38 +00:00
printf 'We wanted to install version %s, but we installed %s\n' "$WANTED_VERSION" "$INSTALLED_VERSION" >&2
exit 1
fi