Add pup() and use() function to allow skipping when pup is unavailable

The "use pup" construct will skip a test case that needs pup installed.
The pup() function ensures that the downloaded binary is used.
pull/93/head
Adrian Perez de Castro 2018-07-03 02:02:25 +03:00 committed by Adrian Perez
parent 60f09e450d
commit 604b43b336
1 changed files with 16 additions and 0 deletions

View File

@ -39,6 +39,22 @@ readonly NGINX_PID="${PREFIX}/logs/nginx.pid"
rm -f "${NGINX_CONF}" "${NGINX_PID}"
mkdir -p "${PREFIX}/logs"
function pup () {
if [[ -x ${TESTDIR}/pup ]] ; then
"${TESTDIR}/pup" "$@"
else
skip 'Test uses "pup", which is not available'
fi
}
function use () {
case $1 in
pup ) [[ -x ${TESTDIR}/pup ]] \
|| skip 'Test uses "pup", which is unavailable\n' ;;
* ) warn "Invalid 'use' flag: '%s'\n'" "$1" ;;
esac
}
function nginx () {
env - PATH="${PATH}" "${PREFIX}/sbin/nginx" "$@"
}