FreeBSD Bugzilla – Attachment 121833 Details for
Bug 164896
[exp-run] add support for testing perl modules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
test_framework.diff
test_framework.diff (text/plain), 10.62 KB, created by
Steve Wills
on 2012-04-26 04:24:06 UTC
(
hide
)
Description:
test_framework.diff
Filename:
MIME Type:
Creator:
Steve Wills
Created:
2012-04-26 04:24:06 UTC
Size:
10.62 KB
patch
obsolete
>Index: Mk/bsd.perl.mk >=================================================================== >RCS file: /home/pcvs/ports/Mk/bsd.perl.mk,v >retrieving revision 1.24 >diff -u -r1.24 bsd.perl.mk >--- Mk/bsd.perl.mk 11 Mar 2012 05:22:01 -0000 1.24 >+++ Mk/bsd.perl.mk 26 Apr 2012 02:24:20 -0000 >@@ -29,6 +29,7 @@ > # (value: perl5.8) > # SITE_PERL - Directory name where site specific perl packages go. > # This value is added to PLIST_SUB. >+# USE_PERL_TEST - Try to test all Perl modules > # USE_PERL5 - If set, this port uses perl5 in one or more of the extract, > # patch, build, install or run phases. > # PERL_CONFIGURE >@@ -227,3 +228,7 @@ > .endif # !defined(USE_GMAKE) > .endif # defined(PERL_MODBUILD) > .endif # defined(_POSTMKINCLUDED) && !defined(Perl_Post_Include) >+ >+.if defined(WITH_PERL_TESTS) && ( defined(PERL_CONFIGURE) || defined(PERL_MODBUILD) ) >+USE_TESTS= yes >+.endif >Index: Mk/bsd.port.mk >=================================================================== >RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v >retrieving revision 1.708 >diff -u -r1.708 bsd.port.mk >--- Mk/bsd.port.mk 13 Mar 2012 08:14:45 -0000 1.708 >+++ Mk/bsd.port.mk 26 Apr 2012 02:24:20 -0000 >@@ -1514,6 +1514,12 @@ > .include "${PORTSDIR}/Mk/bsd.ncurses.mk" > .endif > >+# NOTE: Leave test as last so any other Mk/bsd.*.mk can override defaults >+# and targets. >+.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS) >+.include "${PORTSDIR}/Mk/bsd.test.mk" >+.endif >+ > # You can force skipping these test by defining IGNORE_PATH_CHECKS > .if !defined(IGNORE_PATH_CHECKS) > .if (${PREFIX:C,(^.).*,\1,} != "/") >@@ -2093,6 +2099,10 @@ > .include "${PORTSDIR}/Mk/bsd.cmake.mk" > .endif > >+.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS) >+.include "${PORTSDIR}/Mk/bsd.test.mk" >+.endif >+ > .if exists(${PORTSDIR}/../Makefile.inc) > .include "${PORTSDIR}/../Makefile.inc" > USE_SUBMAKE= yes >@@ -4276,6 +4286,14 @@ > .else > _CHROOT_SEQ= > .endif >+.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS) >+_TEST_TARGET= test >+_INSTALL_DEP= test >+.else >+_TEST_TARGET= #emtpy >+_INSTALL_DEP= build >+.endif >+ > _SANITY_SEQ= ${_CHROOT_SEQ} pre-everything check-makefile \ > check-categories check-makevars check-desktop-entries \ > check-depends identify-install-conflicts check-deprecated \ >@@ -4301,7 +4319,6 @@ > _BUILD_DEP= configure > _BUILD_SEQ= build-message pre-build pre-build-script do-build \ > post-build post-build-script >-_INSTALL_DEP= build > _INSTALL_SEQ= install-message check-install-conflicts run-depends lib-depends apply-slist pre-install \ > pre-install-script generate-plist check-already-installed > _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ >@@ -4336,7 +4353,7 @@ > # Main logic. The loop generates 6 main targets and using cookies > # ensures that those already completed are skipped. > >-.for target in extract patch configure build install package >+.for target in extract patch configure build ${_TEST_TARGET} install package > > .if !target(${target}) && defined(_OPTIONS_OK) > ${target}: ${${target:U}_COOKIE} >Index: Mk/bsd.test.mk >=================================================================== >RCS file: Mk/bsd.test.mk >diff -N Mk/bsd.test.mk >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Mk/bsd.test.mk 26 Apr 2012 02:24:20 -0000 >@@ -0,0 +1,237 @@ >+# vim: ts=4 sw=4 >+# $FreeBSD$ >+# >+# Ports test framework. >+# >+# USE_TESTS - Must be defined in port Makefile for this file to >+# be included. >+# >+# NO_TEST - Don't try to test an individual port, meant to be set >+# in individual ports >+# >+# TEST_DEPENDS - Dependencies required to run tests successfully. Will be >+# added to BUILD_DEPENDS. >+# >+# TEST_WRKSRC - Base directory for tests. Default ${WRKSRC}. >+# >+# TEST_ENV - Variables to be added to the test environment. They will >+# complement MAKE_ENV or SCRIPTS_ENV whichever applies, but >+# will only be set during the testing stage. >+# >+# TEST_TARGET - Alternate target name. Default: check if GNU_CONFIGURE is >+# is set, test otherwise. >+# >+# TEST_SCRIPT - If set, run script relative ${TEST_WRKSRC} instead of >+# invoking make. Uses ${SCRIPT_ENV}. Default: unset. >+# If the script is not executable set this variable to the >+# interpreter and add the actual script to TEST_SCRIPT_ARGS. >+# E.g.: >+# TEST_SCRIPT= ${PYTHON_CMD} >+# TEST_SCRIPT_ARGS=test.py run >+# >+# TEST_SCRIPT_ARGS - Arguments for ${TEST_SCRIPT} >+# >+# TEST_BROKEN_TESTS - List of tests relative to ${TEST_WRKSRC} that should be >+# removed prior to testing. This is meant for tests that >+# hang the test process if they are run. >+# >+# TEST_FAIL_OK - If the tests are known to fail, but the software considered >+# "in working order", set this variable and specify the >+# reason in a similar fashion as IGNORE. The tests will >+# still run so one can see the failures, but it will not hold >+# the installation process. >+# >+# Flags: >+# >+# TEST_INTERACTIVE - Set if the test requires tty input or a tty device. >+# >+# TEST_REQUIRE_NETWORKING - Set if the tests require networking. Tests will be >+# disabled by relevant user flag below and PACKAGE_BUILDING. >+# >+# TEST_REQUIRE_LOCALHOST - Set if the tests require localhost or 127.0.0.1 to >+# be available in the host. Also sets TEST_REQUIRE_NETWORKING. >+# Test will be disabled if jailed. >+# >+# TEST_REQUIRE_RAW_SOCKETS - Set if the tests require raw sockets. Sets >+# *_NETWORKING and tests will be disabled if jailed. >+# >+# User flags: >+# DISABLE_TESTS - This file won't even be included. >+# WITHOUT_NETWORKED_TESTS - Disable tests that require networking. >+# >+ >+.if !defined(_TESTMKINCLUDED) >+ >+_TESTMKINCLUDED=$$Rev$$ >+ >+TEST_COOKIE?= ${WRKDIR}/.test_done.${PORTNAME}.${PREFIX:S/\//_/g} >+TEST_DIRS?= . #yes a dot >+TEST_ENV?= #empty >+TEST_WRKSRC?= ${WRKSRC} >+_TEST_IS_JAILED!= ${SYSCTL} -n security.jail.jailed >+ >+.if defined(TEST_REQUIRE_LOCALHOST) >+TEST_REQUIRE_NETWORKING= Requires localhost >+.endif >+ >+.if defined(TEST_REQUIRE_RAW_SOCKETS) >+TEST_REQUIRE_NETWORKING= Requires raw sockets >+.endif >+ >+.if defined(PACKAGE_BUILDING) >+WITHOUT_NETWORKED_TESTS=yes >+.endif >+ >+.if defined(TEST_REQUIRE_NETWORKING) && ${TEST_REQUIRE_NETWORKING} == yes >+TEST_REQUIRE_NETWORKING= Networked tests disabled by flag >+.endif >+ >+_TEST_DEP= build >+.if ( defined(TEST_INTERACTIVE) && defined(BATCH) ) || \ >+ defined(NO_TEST) || \ >+ ( defined(TEST_REQUIRE_LOCALHOST) && ${_TEST_IS_JAILED} == 1 ) || \ >+ ( defined(TEST_REQUIRE_RAW_SOCKETS) && ${_TEST_IS_JAILED} == 1 ) || \ >+ ( defined(TEST_REQUIRE_NETWORKING) && defined(WITHOUT_NETWORKED_TESTS) ) >+_TEST_SEQ= test-message >+.else >+_TEST_SEQ= test-message test-rm-broken pre-test do-test post-test \ >+ test-results-message >+.endif >+ >+.if defined(TEST_INTERACTIVE) && !defined(BATCH) >+IS_INTERACTIVE= yes >+.endif >+ >+# Here we try to define some generic ways of testing that may work with many >+# ports >+ >+# The bulk of GNU configure scripts use a check target, inspired by >+# automake or autotest. >+.if defined(GNU_CONFIGURE) >+TEST_TARGET?= check >+.else >+TEST_TARGET?= test >+.endif >+.if defined(USE_GMAKE) >+_TEST_MAKE= ${GMAKE} >+.else >+_TEST_MAKE= ${MAKE} >+.endif >+ >+# Try to use build in Perl tests for Perl ports >+.if defined(PERL_CONFIGURE) ||defined(PERL_MODBUILD) >+TEST_ADD_RUNDEPS= yes >+# Build.pl tests run slightly differently >+.if defined(PERL_MODBUILD) >+_TEST_MAKE= ${PERL5} ${PL_BUILD} >+.endif # PERL_MODBUILD >+# Multiple test jobs support for Perl >+.if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE) >+TEST_JOBS_NUMBER= # empty >+.else >+.if defined(MAKE_JOBS_SAFE) || defined(FORCE_MAKE_JOBS) >+TEST_JOBS_NUMBER?= `${SYSCTL} -n kern.smp.cpus` >+TEST_ENV+= HARNESS_OPTIONS=j${TEST_JOBS_NUMBER} >+.endif # MAKE_JOBS_SAFE or FORCE_MAKE_JOBS >+.endif # DISABLE_MAKE_JOBS or MAKE_JOBS_UNSAFE >+.endif # PERL_CONFIGURE or PERL_MODBUILD >+ >+# TODO: add additional generic testing support here >+ >+.if defined(TEST_ADD_RUNDEPS) >+TEST_DEPENDS+= ${RUN_DEPENDS} >+.endif >+ >+.if defined(TEST_DEPENDS) >+BUILD_DEPENDS+= ${TEST_DEPENDS} >+.endif >+ >+.if defined(TEST_FAIL_OK) >+_TEST_OK= ||true >+.else >+_TEST_OK= #empty >+.endif >+ >+.endif # !_TESTMKINCLUDED >+ >+.if defined(_POSTMKINCLUDED) && defined(_TESTMKINCLUDED) >+.if !target(test-message) >+test-message: >+.if defined(TEST_INTERACTIVE) && defined(BATCH) >+ @${ECHO_MSG} "===> Skipping interactive tests" >+.elif defined(TEST_REQUIRE_LOCALHOST) && ${_TEST_IS_JAILED} == 1 >+ @${ECHO_MSG} "===> Skipping tests: requires localhost and we are jailed" >+.elif defined(TEST_REQUIRE_RAW_SOCKETS) && ${_TEST_IS_JAILED} == 1 >+ @${ECHO_MSG} "===> Skipping tests: requires raw sockets and we are jailed" >+.elif defined(TEST_REQUIRE_NETWORKING) && defined(WITHOUT_NETWORKED_TESTS) >+ @${ECHO_MSG} "===> Skipping tests: ${TEST_REQUIRE_NETWORKING}" >+.elif defined(NO_TEST) >+ @${ECHO_MSG} "===> Skipping tests: ${NO_TEST}" >+.else >+ @${ECHO_MSG} "===> Testing for ${PKGNAME}" >+.endif >+.if !defined(USE_TESTS) >+ @${ECHO_MSG} "WARNING: USE_TESTS not set in ${PKGORIGIN}/Makefile" >+.endif >+.endif >+ >+.if !target(test-rm-broken) >+test-rm-broken: >+.if defined(TEST_BROKEN_TESTS) >+ @${ECHO_MSG} "===> Removing tests that may hang the test process:" >+.for test in ${TEST_BROKEN_TESTS} >+ @${ECHO_MSG} " ${test}" >+ @${RM} ${WRKSRC}/${test} >+.endfor >+.else >+ @${DO_NADA} >+.endif # !defined TEST_BROKEN_TESTS >+.endif # !target >+ >+# Can be used by port to see if any conditions apply that are not handled >+# gracefully by upstream test, like being jailed or having a running instance >+# of the program (databases/virtuoso for example). >+.if !target(pre-test) >+pre-test: >+ @${DO_NADA} >+ >+.endif >+ >+# The real thing(tm) >+# Override this in Makefile if you really need something special. >+.if !target(do-test) >+do-test: >+.for dir in ${TEST_DIRS} >+.if !defined(TEST_SCRIPT) >+ @cd ${WRKSRC}/${dir} && ${SETENV} ${MAKE_ENV} ${TEST_ENV} ${_TEST_MAKE} \ >+ ${TEST_TARGET} ${_TEST_OK} >+.else >+ @cd ${WRKSRC}/${dir} && ${SETENV} ${SCRIPTS_ENV} ${TEST_ENV} \ >+ ${TEST_SCRIPT} ${TEST_SCRIPT_ARGS} ${_TEST_OK} >+.endif # !TEST_SCRIPT >+.endfor # test dirs >+.endif # !target(do-test) >+ >+# Can be used by port to do clean ups or mail test results. >+.if !target(post-test) >+post-test: >+ @${DO_NADA} >+.endif >+ >+.if !target(test-results-message) >+test-results-message: >+.if defined(TEST_FAIL_OK) >+ @${ECHO_CMD} >+ @${ECHO_MSG} "===> Test may have failed because:" >+ @${ECHO_CMD}; ${ECHO_MSG} "${TEST_FAIL_OK}"; ${ECHO_CMD} >+.endif >+ @${ECHO_CMD} "===> Testing completed for ${PKGNAME}" >+.endif >+ >+.if !target(retest) >+retest: >+ -@${RM} ${TEST_COOKIE} >+ @cd ${.CURDIR} && ${MAKE} test >+.endif >+ >+.endif # defined(_POSTMKINCLUDED) && defined(_TESTMKINCLUDED)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 164896
:
121831
|
121832
| 121833 |
121834