Capture output of test build steps

pull/10/head
Michele Locati 2018-12-11 14:33:31 +01:00
parent 2635b0bec6
commit 6fbd39d2fa
1 changed files with 11 additions and 2 deletions

View File

@ -51,11 +51,20 @@ testExtension () {
printf 'PHP version: %s\n' "${2}"
if test -n "$(printf '%s' "${2}" | sed -E 's/^[0-9]+\.[0-9]+$//')"; then
printf ' INVALID PHP VERSION: %s\n' "${2}" >&2
return 0
return 1
fi
testExtension_Image="$(getExtensionImage "${1}" "${2}")"
printf ' - Docker image: %s\n' "${testExtension_Image}"
docker run --rm --volume "${TRAVIS_BUILD_DIR}:/app" --workdir /app "${testExtension_Image}" bash -c "./install-php-extensions ${1} && php -r "'"'"exit(extension_loaded('${1}') ? 0 : 1);"'"'""
testExtension_out=`mktemp`
if $(docker run --rm --volume "${TRAVIS_BUILD_DIR}:/app" --workdir /app "${testExtension_Image}" bash -c "./install-php-extensions ${1} && php -r "'"'"exit(extension_loaded('${1}') ? 0 : 1);"'"'"" >"${testExtension_out}" 2>&1); then
rm -rf "${testExtension_out}"
printf ' - Passed\n'
return 0
fi
printf ' - FAILED!\n' >&2
cat "${testExtension_out}" >&2
rm -rf "${testExtension_out}"
return 1
}
# Test a new extension line