Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
#!/bin/sh
|
|
|
|
# MAINTAINER: portmgr@FreeBSD.org
|
|
|
|
# $FreeBSD$
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
. ${dp_SCRIPTSDIR}/functions.sh
|
|
|
|
|
2015-10-09 20:00:44 +02:00
|
|
|
recursive=0
|
2015-10-19 21:23:53 +02:00
|
|
|
requires_wrkdir=0
|
|
|
|
while getopts "rw" FLAG; do
|
2015-10-09 20:00:44 +02:00
|
|
|
case "${FLAG}" in
|
|
|
|
r)
|
|
|
|
recursive=1
|
|
|
|
;;
|
2015-10-19 21:23:53 +02:00
|
|
|
w)
|
|
|
|
# Only list dependencies that have a WRKDIR. Used for
|
|
|
|
# 'make clean-depends'.
|
|
|
|
requires_wrkdir=1
|
|
|
|
;;
|
2015-10-09 20:00:44 +02:00
|
|
|
*)
|
|
|
|
echo "Unknown flag" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2015-10-09 20:09:02 +02:00
|
|
|
shift $((OPTIND-1))
|
2015-10-09 20:00:44 +02:00
|
|
|
|
2015-12-04 23:18:29 +01:00
|
|
|
validate_env PORTSDIR dp_PKGNAME
|
2015-10-19 21:23:53 +02:00
|
|
|
if [ ${recursive} -eq 1 -o ${requires_wrkdir} -eq 1 ]; then
|
2015-10-19 20:41:01 +02:00
|
|
|
validate_env dp_MAKE
|
|
|
|
# Cache command executions to avoid looking them up again in every
|
|
|
|
# sub-make.
|
2015-12-04 23:18:29 +01:00
|
|
|
MAKE="${dp_MAKE}" export_ports_env >/dev/null
|
2015-10-19 20:41:01 +02:00
|
|
|
fi
|
2015-10-19 20:01:56 +02:00
|
|
|
|
Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
set -u
|
|
|
|
|
|
|
|
check_dep() {
|
2015-10-19 21:23:53 +02:00
|
|
|
local _dep wrkdir show_dep
|
|
|
|
|
Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
for _dep ; do
|
|
|
|
myifs=${IFS}
|
|
|
|
IFS=:
|
|
|
|
set -- ${_dep}
|
|
|
|
IFS=${myifs}
|
|
|
|
|
|
|
|
case "${2}" in
|
|
|
|
/*) d=${2} ;;
|
2015-12-04 23:18:29 +01:00
|
|
|
*) d=${PORTSDIR}/${2} ;;
|
Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
esac
|
|
|
|
|
|
|
|
case " ${checked} " in
|
|
|
|
*\ ${d}\ *) continue ;; # Already checked
|
|
|
|
esac
|
|
|
|
checked="${checked} ${d}"
|
2015-10-19 21:23:53 +02:00
|
|
|
# Check if the dependency actually exists or skip otherwise.
|
Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
if [ ! -d ${d} ]; then
|
|
|
|
echo "${dp_PKGNAME}: \"${d}\" non-existent -- dependency list incomplete" >&2
|
|
|
|
continue
|
|
|
|
fi
|
2015-10-19 21:23:53 +02:00
|
|
|
|
|
|
|
# Grab any needed vars from the port.
|
|
|
|
|
|
|
|
if [ ${requires_wrkdir} -eq 1 -a ${recursive} -eq 1 ]; then
|
|
|
|
set -- $(${dp_MAKE} -C ${d} -VWRKDIR -V_UNIFIED_DEPENDS)
|
|
|
|
wrkdir="$1"
|
|
|
|
shift
|
|
|
|
elif [ ${requires_wrkdir} -eq 1 -a ${recursive} -eq 0 ]; then
|
|
|
|
set -- "$(${dp_MAKE} -C ${d} -VWRKDIR)"
|
|
|
|
wrkdir="$1"
|
|
|
|
elif [ ${recursive} -eq 1 ]; then
|
|
|
|
set -- $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If a WRKDIR is required to show the dependency, check for it.
|
|
|
|
show_dep=1
|
|
|
|
if [ ${requires_wrkdir} -eq 1 ] && ! [ -d "${wrkdir}" ]; then
|
|
|
|
show_dep=0
|
|
|
|
fi
|
|
|
|
[ ${show_dep} -eq 1 ] && echo ${d}
|
2015-10-09 20:00:44 +02:00
|
|
|
if [ ${recursive} -eq 1 ]; then
|
2015-10-19 21:23:53 +02:00
|
|
|
check_dep $@
|
2015-10-09 20:00:44 +02:00
|
|
|
fi
|
Implemented complete support for test target.
You can now `make test' on any port to run test sequence, no-op by default.
If a port defines TEST_TARGET, it'll run sub-make with specified target,
usually `check' or `test', useful if upstream supports that. The port may
instead define custom do-test target, as well as usual satellite targets:
{pre,do,post}-test, {pre,do,post}-test-OPT, {pre,do,post}-test-OPT-off
`make test' builds and stages port first, so test may use both WRKDIR and
STAGEDIR, and both BUILD and RUN depends are available for test target.
Additionally, TEST_DEPENDS is now properly supported and may be used to
define additional depends specifically for testing.
Framework may define default tests for specific cases. For instance,
perl5.mk and cran.mk already provide default test target on their own.
This commit also converts my ports which have tests to this new framework.
Approved by: portmgr (bapt)
Differential Revision: D3680
2015-09-28 19:20:42 +02:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
checked=
|
2015-10-19 21:23:53 +02:00
|
|
|
check_dep $@
|