Index: Mk/Scripts/depends-list.sh =================================================================== --- Mk/Scripts/depends-list.sh +++ Mk/Scripts/depends-list.sh @@ -1,12 +1,12 @@ #!/bin/sh # MAINTAINER: portmgr@FreeBSD.org -# $FreeBSD: head/Mk/Scripts/all-depends-list.sh 391125 2015-07-01 21:08:42Z bapt $ +# $FreeBSD: 391125 2015-07-01 21:08:42Z bapt $ set -e . ${dp_SCRIPTSDIR}/functions.sh -validate_env dp_ALLDEPENDS dp_PORTSDIR dp_PKGNAME dp_MAKE +validate_env dp_ALLDEPENDS dp_PORTSDIR dp_PKGNAME set -u @@ -31,7 +31,6 @@ continue fi echo ${d} - check_dep $(${dp_MAKE} -C ${d} -V_UNIFIED_DEPENDS) done } Index: Mk/Uses/cran.mk =================================================================== --- Mk/Uses/cran.mk +++ Mk/Uses/cran.mk @@ -41,14 +41,14 @@ NO_BUILD= yes R_COMMAND= ${LOCALBASE}/bin/R -.if !target(regression-test) +.if !target(do-test) R_POSTCMD_CHECK_OPTIONS?= --timings .if !exists(${LOCALBASE}/bin/pdflatex) R_POSTCMD_CHECK_OPTIONS+= --no-manual --no-rebuild-vignettes .endif -regression-test: build +do-test: @cd ${WRKDIR} ; ${SETENV} ${MAKE_ENV} _R_CHECK_FORCE_SUGGESTS_=FALSE \ ${R_COMMAND} ${R_PRECMD_CHECK_OPTIONS} CMD check \ ${R_POSTCMD_CHECK_OPTIONS} ${PORTNAME} Index: Mk/Uses/perl5.mk =================================================================== --- Mk/Uses/perl5.mk +++ Mk/Uses/perl5.mk @@ -308,19 +308,14 @@ @${RM} -f ${STAGEDIR}${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH}/perllocal.pod* || : @${RMDIR} -p ${STAGEDIR}${PREFIX}/lib/perl5/${PERL_VER}/${PERL_ARCH} 2>/dev/null || : -.if !target(regression-test) -TEST_ARGS?= ${MAKE_ARGS} -TEST_ENV?= ${MAKE_ENV} +.if !target(do-test) TEST_TARGET?= test TEST_WRKSRC?= ${BUILD_WRKSRC} -.if !target(test) -test: regression-test -.endif # test -regression-test: build +do-test: .if ${USE_PERL5:Mmodbuild*} - -cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${PERL5} ${PL_BUILD} ${TEST_TARGET} ${TEST_ARGS} + cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${PERL5} ${PL_BUILD} ${TEST_TARGET} ${TEST_ARGS} .elif ${USE_PERL5:Mconfigure} - -cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${MAKE_CMD} ${TEST_ARGS} ${TEST_TARGET} + cd ${TEST_WRKSRC}/ && ${SETENV} ${TEST_ENV} ${MAKE_CMD} ${TEST_ARGS} ${TEST_TARGET} .endif # USE_PERL5:Mmodbuild* .endif # regression-test .endif # defined(_POSTMKINCLUDED) Index: Mk/bsd.options.mk =================================================================== --- Mk/bsd.options.mk +++ Mk/bsd.options.mk @@ -162,6 +162,7 @@ configure:300:pre configure:500:do configure:700:post \ build:300:pre build:500:do build:700:post \ install:300:pre install:500:do install:700:post \ + test:300:pre test:500:do test:700:post \ package:300:pre package:500:do package:700:post \ stage:800:post Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -296,6 +296,17 @@ # package depends on. "lib" is the name of a shared library. # make will use "ldconfig -r" to search for the library. # lib can contain extended regular expressions. +# TEST_DEPENDS - A list of "path:dir[:target]" tuples of other ports this +# package depends on in the "test" stage. "path" is the +# name of a file if it starts with a slash (/), an +# executable otherwise. make will test for the existence +# (if it is a full pathname) or search for it in your +# $PATH (if it is an executable) and go into "dir" to do +# a "make all install" if it's not found. If the third +# field ("target") exists, it will be used instead of +# ${DEPENDS_TARGET}. The first field also supports a +# package name with a version range, in the form package>=1.2 +# if a particular version is desired. # DEPENDS_TARGET # - The default target to execute when a port is calling a # dependency. @@ -650,6 +661,9 @@ # run-depends-list # - Show all directories which are run-dependencies # for this port. +# test-depends-list +# - Show all directories which are test-dependencies +# for this port. # # extract - Unpacks ${DISTFILES} into ${WRKDIR}. # patch - Apply any provided patches to the source. @@ -661,6 +675,7 @@ # flag. # deinstall - Remove the installation. # deinstall-all - Remove all installations with the same PKGORIGIN. +# test - Run tests for the port. # package - Create a package from an _installed_ port. # package-recursive # - Create a package for a port and _all_ of its dependencies. @@ -717,6 +732,7 @@ # # NO_BUILD - Use a dummy (do-nothing) build target. # NO_INSTALL - Use a dummy (do-nothing) install target. +# NO_TEST - Use a dummy (do-nothing) test target. # # Here are some variables used in various stages. # @@ -845,6 +861,18 @@ # - Disable CCACHE support for example for certain ports if # CCACHE is enabled. User settable. # +# For test: +# +# TEST_TARGET - Target for sub-make in test stage. If not defined, +# no default test target is provided. +# Default: (none) +# TEST_WRKSRC - Directory to do test in (default: ${WRKSRC}). +# TEST_ENV - Additional environment vars passed to sub-make in test +# stage +# Default: ${MAKE_ENV} +# TEST_ARGS - Any extra arguments to sub-make in test stage +# Default: ${MAKE_ARGS} +# # For install: # # INSTALL_TARGET @@ -1422,7 +1450,7 @@ DESTDIRNAME?= DESTDIR # setup empty variables for USES targets -.for target in sanity fetch extract patch configure build install package stage +.for target in sanity fetch extract patch configure build install test package stage _USES_${target}?= .endfor @@ -1477,6 +1505,9 @@ PKG_NOTE_no_provide_shlib= yes .endif +TEST_ARGS?= ${MAKE_ARGS} +TEST_ENV?= ${MAKE_ENV} + PKG_ENV+= PORTSDIR=${PORTSDIR} CONFIGURE_ENV+= XDG_DATA_HOME=${WRKDIR} \ XDG_CONFIG_HOME=${WRKDIR} \ @@ -1546,6 +1577,7 @@ CONFIGURE_WRKSRC?= ${WRKSRC} BUILD_WRKSRC?= ${WRKSRC} INSTALL_WRKSRC?=${WRKSRC} +TEST_WRKSRC?= ${WRKSRC} PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} \ RESETPREFIX=${PREFIX} @@ -1932,6 +1964,7 @@ EXTRACT_COOKIE?= ${WRKDIR}/.extract_done.${PORTNAME}.${PREFIX:S/\//_/g} CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done.${PORTNAME}.${PREFIX:S/\//_/g} INSTALL_COOKIE?= ${WRKDIR}/.install_done.${PORTNAME}.${PREFIX:S/\//_/g} +TEST_COOKIE?= ${WRKDIR}/.test_done.${PORTNAME}.${PREFIX:S/\//_/g} BUILD_COOKIE?= ${WRKDIR}/.build_done.${PORTNAME}.${PREFIX:S/\//_/g} PATCH_COOKIE?= ${WRKDIR}/.patch_done.${PORTNAME}.${PREFIX:S/\//_/g} PACKAGE_COOKIE?= ${WRKDIR}/.package_done.${PORTNAME}.${PREFIX:S/\//_/g} @@ -2792,7 +2825,7 @@ .endif _TARGETS= check-sanity fetch checksum extract patch configure all build \ - install reinstall package stage restage + install reinstall test package stage restage .for target in ${_TARGETS} .if !target(${target}) @@ -2918,6 +2951,12 @@ @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE} .endif +# Disable test +.if defined(NO_TEST) && !target(test) +test: stage + @${TOUCH} ${TOUCH_FLAGS} ${TEST_COOKIE} +.endif + # Disable package .if defined(NO_PACKAGE) && !target(package) package: @@ -3453,6 +3492,23 @@ @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${FAKEROOT} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET}) .endif +# Test + +.if !target(do-test) && defined(TEST_TARGET) +DO_MAKE_TEST?= ${SETENV} ${TEST_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${TEST_ARGS:C,^${DESTDIRNAME}=.*,,g} +do-test: + @(cd ${TEST_WRKSRC}; if ! ${DO_MAKE_TEST} ${TEST_TARGET}; then \ + if [ -n "${TEST_FAIL_MESSAGE}" ] ; then \ + ${ECHO_MSG} "===> Tests failed unexpectedly."; \ + (${ECHO_CMD} "${TEST_FAIL_MESSAGE}") | ${FMT} 75 79 ; \ + fi; \ + ${FALSE}; \ + fi) +.elif !target(do-test) +do-test: + @${DO_NADA} +.endif + # Package .if !target(do-package) @@ -3739,6 +3795,8 @@ @${ECHO_MSG} "===> Staging for ${PKGNAME}" install-message: @${ECHO_MSG} "===> Installing for ${PKGNAME}" +test-message: + @${ECHO_MSG} "===> Testing for ${PKGNAME}" package-message: @${ECHO_MSG} "===> Building package for ${PKGNAME}" @@ -4259,7 +4317,7 @@ .if !target(depends) depends: pkg-depends extract-depends patch-depends lib-depends fetch-depends build-depends run-depends -.for deptype in PKG EXTRACT PATCH FETCH BUILD LIB RUN +.for deptype in PKG EXTRACT PATCH FETCH BUILD LIB RUN TEST ${deptype:tl}-depends: .if defined(${deptype}_DEPENDS) && !defined(NO_DEPENDS) @${SETENV} \ @@ -4290,7 +4348,7 @@ # Dependency lists: both build and runtime, recursive. Print out directory names. -_UNIFIED_DEPENDS=${PKG_DEPENDS} ${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} +_UNIFIED_DEPENDS=${PKG_DEPENDS} ${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} ${TEST_DEPENDS} _DEPEND_SPECIALS= ${_UNIFIED_DEPENDS:M*\:*\:*:C,^[^:]*:([^:]*):.*$,\1,} all-depends-list: @@ -4457,6 +4515,18 @@ fi; \ done | ${SORT} -u +test-depends-list: +.if defined(TEST_DEPENDS) + @${TEST-DEPENDS-LIST} +.endif + +TEST-DEPENDS-LIST= \ + ${SETENV} dp_ALLDEPENDS="${TEST_DEPENDS}" \ + dp_PORTSDIR="${PORTSDIR}" \ + dp_PKGNAME="${PKGNAME}" \ + dp_SCRIPTSDIR="${SCRIPTSDIR}" \ + ${SH} ${SCRIPTSDIR}/depends-list.sh + # Package (recursive runtime) dependency list. Print out both directory names # and package names. @@ -5555,7 +5625,7 @@ # Please note that the order of the following targets is important, and # should not be modified. -_TARGETS_STAGES= SANITY PKG FETCH EXTRACT PATCH CONFIGURE BUILD INSTALL PACKAGE STAGE +_TARGETS_STAGES= SANITY PKG FETCH EXTRACT PATCH CONFIGURE BUILD INSTALL TEST PACKAGE STAGE # Define the SEQ of actions to take when each target is ran, and which targets # it depends on before running its SEQ. @@ -5619,6 +5689,10 @@ .if defined(DEVELOPER) _STAGE_SEQ+= 995:stage-qa .endif +_TEST_DEP= stage +_TEST_SEQ= 100:test-message 150:test-depends 300:pre-test 500:do-test \ + 800:post-test \ + ${_OPTIONS_test} ${_USES_test} _INSTALL_DEP= stage _INSTALL_SEQ= 100:install-message 150:run-depends 151:lib-depends \ 200:check-already-installed @@ -5669,7 +5743,7 @@ # See above *_SEQ and *_DEP. The _DEP will run before this defined target is # ran. The _SEQ will run as this target once _DEP is satisfied. -.for target in extract patch configure build stage install package +.for target in extract patch configure build stage install test package # Check if config dialog needs to show and execute it if needed. If is it not # needed (_OPTIONS_OK), then just depend on the cookie which is defined later Index: astro/osmium/Makefile =================================================================== --- astro/osmium/Makefile +++ astro/osmium/Makefile @@ -46,9 +46,6 @@ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \ ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKR_ARGS} doc -regression-test: - cd ${WRKSRC}/test && ${SETENV} ${MAKE_ENV} ${SH} run_tests.sh - do-install: cd ${WRKSRC}/include && ${COPYTREE_SHARE} '${PORTNAME} ${PORTNAME}.hpp' \ ${STAGEDIR}${PREFIX}/include/ @@ -58,4 +55,7 @@ do-install-DOXYGEN-on: cd ${WRKSRC}/doc && ${COPYTREE_SHARE} html ${STAGEDIR}${DOCSDIR}/ +do-test: + cd ${WRKSRC}/test && ${SETENV} ${MAKE_ENV} ${SH} run_tests.sh + .include Index: devel/pire/Makefile =================================================================== --- devel/pire/Makefile +++ devel/pire/Makefile @@ -20,22 +20,9 @@ INSTALL_TARGET= install-strip USES= autoreconf bison gmake libtool USE_LDCONFIG= yes +TEST_TARGET= check ONLY_FOR_ARCHS= amd64 i386 ia64 ONLY_FOR_ARCHS_REASON= not yet ported to big-endian platforms -OPTIONS_DEFINE= UNITTEST -UNITTEST_DESC= Compile with unittest support - -.include - -.if ${PORT_OPTIONS:MUNITTEST} || defined(PACKAGE_BUILDING) -BUILD_DEPENDS+= cppunit-config:${PORTSDIR}/devel/cppunit -CONFIGURE_ARGS+=--with-cppunit-prefix=${LOCALBASE} - -regression-test: build - @cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} check || \ - (${CAT} ${WRKSRC}/tests/test-suite.log; false) -.endif - .include Index: devel/sdl2pp/Makefile =================================================================== --- devel/sdl2pp/Makefile +++ devel/sdl2pp/Makefile @@ -19,6 +19,7 @@ CMAKE_ARGS= -DSDL2PP_ENABLE_LIVE_TESTS=OFF \ -DSDL2PP_WITH_WERROR=ON USE_SDL= sdl2 image2 mixer2 ttf2 +TEST_TARGET= test PORTDOCS= * @@ -40,7 +41,4 @@ post-install-DOXYGEN-on: cd ${CONFIGURE_WRKSRC} && ${COPYTREE_SHARE} doxygen ${STAGEDIR}${DOCSDIR}/ -regression-test: build - cd ${WRKSRC} && ${DO_MAKE_BUILD} test - .include Index: games/spring/Makefile =================================================================== --- games/spring/Makefile +++ games/spring/Makefile @@ -52,6 +52,9 @@ # Do not exctract bundled copies of header files for 3rd-party packages: EXTRACT_AFTER_ARGS=--no-same-owner --no-same-permissions --exclude ${WRKSRC:T}/include +# The check-target fails right now: https://springrts.com/mantis/view.php?id=4736 +TEST_TARGET= check + PORTDOCS= * PORTDATA= * @@ -75,10 +78,6 @@ PR_DOWNLOADER_LIB_DEPENDS=libcurl.so:${PORTSDIR}/ftp/curl -# The check-target fails right now: https://springrts.com/mantis/view.php?id=4736 -check test xregression-test: build - ${MAKE} -C ${WRKSRC} check - .include .if ${OPSYS} == FreeBSD && ${OSVERSION} < 1000000 Index: graphics/glosm/Makefile =================================================================== --- graphics/glosm/Makefile +++ graphics/glosm/Makefile @@ -18,15 +18,13 @@ USE_SDL= sdl USE_GITHUB= yes GH_ACCOUNT= AMDmi3 +TEST_TARGET= test PORTDOCS= README ChangeLog OPTIONS_DEFINE= DOCS -regression-test: - cd ${BUILD_WRKSRC} && ctest - -post-install: +post-install-DOCS-on: ${MKDIR} ${STAGEDIR}${DOCSDIR} .for f in ${PORTDOCS} ${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/