View | Details | Raw Unified | Return to bug 164896 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/bsd.perl.mk (+5 lines)
Lines 29-34 Link Here
29
#				  (value: perl5.8)
29
#				  (value: perl5.8)
30
# SITE_PERL		- Directory name where site specific perl packages go.
30
# SITE_PERL		- Directory name where site specific perl packages go.
31
#				  This value is added to PLIST_SUB.
31
#				  This value is added to PLIST_SUB.
32
# USE_PERL_TEST	- Try to test all Perl modules
32
# USE_PERL5		- If set, this port uses perl5 in one or more of the extract,
33
# USE_PERL5		- If set, this port uses perl5 in one or more of the extract,
33
#				  patch, build, install or run phases.
34
#				  patch, build, install or run phases.
34
# PERL_CONFIGURE
35
# PERL_CONFIGURE
Lines 227-229 Link Here
227
.endif # !defined(USE_GMAKE)
228
.endif # !defined(USE_GMAKE)
228
.endif # defined(PERL_MODBUILD)
229
.endif # defined(PERL_MODBUILD)
229
.endif # defined(_POSTMKINCLUDED) && !defined(Perl_Post_Include)
230
.endif # defined(_POSTMKINCLUDED) && !defined(Perl_Post_Include)
231
232
.if defined(WITH_PERL_TESTS) && ( defined(PERL_CONFIGURE) || defined(PERL_MODBUILD) )
233
USE_TESTS=	yes
234
.endif
(-)Mk/bsd.port.mk (-2 / +19 lines)
Lines 1514-1519 Link Here
1514
.include "${PORTSDIR}/Mk/bsd.ncurses.mk"
1514
.include "${PORTSDIR}/Mk/bsd.ncurses.mk"
1515
.endif
1515
.endif
1516
1516
1517
# NOTE: Leave test as last so any other Mk/bsd.*.mk can override defaults
1518
# and targets.
1519
.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS)
1520
.include "${PORTSDIR}/Mk/bsd.test.mk"
1521
.endif
1522
1517
# You can force skipping these test by defining IGNORE_PATH_CHECKS
1523
# You can force skipping these test by defining IGNORE_PATH_CHECKS
1518
.if !defined(IGNORE_PATH_CHECKS)
1524
.if !defined(IGNORE_PATH_CHECKS)
1519
.if (${PREFIX:C,(^.).*,\1,} != "/")
1525
.if (${PREFIX:C,(^.).*,\1,} != "/")
Lines 2093-2098 Link Here
2093
.include "${PORTSDIR}/Mk/bsd.cmake.mk"
2099
.include "${PORTSDIR}/Mk/bsd.cmake.mk"
2094
.endif
2100
.endif
2095
2101
2102
.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS)
2103
.include "${PORTSDIR}/Mk/bsd.test.mk"
2104
.endif
2105
2096
.if exists(${PORTSDIR}/../Makefile.inc)
2106
.if exists(${PORTSDIR}/../Makefile.inc)
2097
.include "${PORTSDIR}/../Makefile.inc"
2107
.include "${PORTSDIR}/../Makefile.inc"
2098
USE_SUBMAKE=	yes
2108
USE_SUBMAKE=	yes
Lines 4276-4281 Link Here
4276
.else
4286
.else
4277
_CHROOT_SEQ=
4287
_CHROOT_SEQ=
4278
.endif
4288
.endif
4289
.if ( defined(USE_TESTS) || defined(TEST_DEPENDS) ) && !defined(DISABLE_TESTS)
4290
_TEST_TARGET=	test
4291
_INSTALL_DEP=	test
4292
.else
4293
_TEST_TARGET=	#emtpy
4294
_INSTALL_DEP=	build
4295
.endif
4296
4279
_SANITY_SEQ=	${_CHROOT_SEQ} pre-everything check-makefile \
4297
_SANITY_SEQ=	${_CHROOT_SEQ} pre-everything check-makefile \
4280
				check-categories check-makevars check-desktop-entries \
4298
				check-categories check-makevars check-desktop-entries \
4281
				check-depends identify-install-conflicts check-deprecated \
4299
				check-depends identify-install-conflicts check-deprecated \
Lines 4301-4307 Link Here
4301
_BUILD_DEP=		configure
4319
_BUILD_DEP=		configure
4302
_BUILD_SEQ=		build-message pre-build pre-build-script do-build \
4320
_BUILD_SEQ=		build-message pre-build pre-build-script do-build \
4303
				post-build post-build-script
4321
				post-build post-build-script
4304
_INSTALL_DEP=	build
4305
_INSTALL_SEQ=	install-message check-install-conflicts run-depends lib-depends apply-slist pre-install \
4322
_INSTALL_SEQ=	install-message check-install-conflicts run-depends lib-depends apply-slist pre-install \
4306
				pre-install-script generate-plist check-already-installed
4323
				pre-install-script generate-plist check-already-installed
4307
_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
4324
_INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
Lines 4336-4342 Link Here
4336
# Main logic. The loop generates 6 main targets and using cookies
4353
# Main logic. The loop generates 6 main targets and using cookies
4337
# ensures that those already completed are skipped.
4354
# ensures that those already completed are skipped.
4338
4355
4339
.for target in extract patch configure build install package
4356
.for target in extract patch configure build ${_TEST_TARGET} install package
4340
4357
4341
.if !target(${target}) && defined(_OPTIONS_OK)
4358
.if !target(${target}) && defined(_OPTIONS_OK)
4342
${target}: ${${target:U}_COOKIE}
4359
${target}: ${${target:U}_COOKIE}
(-)Mk/bsd.test.mk (+237 lines)
Added Link Here
1
# vim: ts=4 sw=4
2
# $FreeBSD$
3
#
4
# Ports test framework.
5
#
6
# USE_TESTS		- Must be defined in port Makefile for this file to
7
# 			  	  be included. 
8
#
9
# NO_TEST		- Don't try to test an individual port, meant to be set
10
# 			  	  in individual ports
11
#
12
# TEST_DEPENDS	- Dependencies required to run tests successfully. Will be
13
# 				  added to BUILD_DEPENDS.
14
#
15
# TEST_WRKSRC	- Base directory for tests. Default ${WRKSRC}.
16
#
17
# TEST_ENV		- Variables to be added to the test environment. They will
18
#                 complement MAKE_ENV or SCRIPTS_ENV whichever applies, but
19
#                 will only be set during the testing stage.
20
#
21
# TEST_TARGET	- Alternate target name. Default: check if GNU_CONFIGURE is
22
#                 is set, test otherwise.
23
#
24
# TEST_SCRIPT	- If set, run script relative ${TEST_WRKSRC} instead of
25
#                 invoking make. Uses ${SCRIPT_ENV}. Default: unset.
26
#                 If the script is not executable set this variable to the
27
#                 interpreter and add the actual script to TEST_SCRIPT_ARGS.
28
#                 E.g.:
29
#                 TEST_SCRIPT= ${PYTHON_CMD}
30
#                 TEST_SCRIPT_ARGS=test.py run
31
#
32
# TEST_SCRIPT_ARGS - Arguments for ${TEST_SCRIPT}
33
#
34
# TEST_BROKEN_TESTS - List of tests relative to ${TEST_WRKSRC} that should be
35
# 				  removed prior to testing. This is meant for tests that
36
# 				  hang the test process if they are run.
37
#
38
# TEST_FAIL_OK	- If the tests are known to fail, but the software considered
39
#                 "in working order", set this variable and specify the
40
#                 reason in a similar fashion as IGNORE. The tests will
41
#                 still run so one can see the failures, but it will not hold
42
#                 the installation process.
43
#
44
# Flags:
45
#
46
# TEST_INTERACTIVE - Set if the test requires tty input or a tty device.
47
#
48
# TEST_REQUIRE_NETWORKING - Set if the tests require networking. Tests will be
49
# 				  disabled by relevant user flag below and PACKAGE_BUILDING.
50
#
51
# TEST_REQUIRE_LOCALHOST - Set if the tests require localhost or 127.0.0.1 to
52
# 				  be available in the host. Also sets TEST_REQUIRE_NETWORKING.
53
# 				  Test will be disabled if jailed.
54
#
55
# TEST_REQUIRE_RAW_SOCKETS - Set if the tests require raw sockets. Sets
56
#				  *_NETWORKING and tests will be disabled if jailed.
57
#
58
# User flags:
59
# DISABLE_TESTS	- This file won't even be included.
60
# WITHOUT_NETWORKED_TESTS - Disable tests that require networking.
61
#
62
63
.if !defined(_TESTMKINCLUDED)
64
65
_TESTMKINCLUDED=$$Rev$$
66
67
TEST_COOKIE?=	${WRKDIR}/.test_done.${PORTNAME}.${PREFIX:S/\//_/g}
68
TEST_DIRS?=		. #yes a dot
69
TEST_ENV?=		#empty
70
TEST_WRKSRC?=	${WRKSRC}
71
_TEST_IS_JAILED!=	${SYSCTL} -n security.jail.jailed
72
73
.if defined(TEST_REQUIRE_LOCALHOST)
74
TEST_REQUIRE_NETWORKING=	Requires localhost
75
.endif
76
77
.if defined(TEST_REQUIRE_RAW_SOCKETS)
78
TEST_REQUIRE_NETWORKING=	Requires raw sockets
79
.endif
80
81
.if defined(PACKAGE_BUILDING)
82
WITHOUT_NETWORKED_TESTS=yes
83
.endif
84
85
.if defined(TEST_REQUIRE_NETWORKING) && ${TEST_REQUIRE_NETWORKING} == yes
86
TEST_REQUIRE_NETWORKING=	Networked tests disabled by flag
87
.endif
88
89
_TEST_DEP=	build
90
.if ( defined(TEST_INTERACTIVE) && defined(BATCH) ) ||  \
91
	defined(NO_TEST) || \
92
	( defined(TEST_REQUIRE_LOCALHOST) && ${_TEST_IS_JAILED} == 1 ) || \
93
	( defined(TEST_REQUIRE_RAW_SOCKETS) && ${_TEST_IS_JAILED} == 1 ) || \
94
	( defined(TEST_REQUIRE_NETWORKING) && defined(WITHOUT_NETWORKED_TESTS) )
95
_TEST_SEQ=	test-message
96
.else
97
_TEST_SEQ=	test-message test-rm-broken pre-test do-test post-test \
98
			test-results-message
99
.endif
100
101
.if defined(TEST_INTERACTIVE) && !defined(BATCH)
102
IS_INTERACTIVE=	yes
103
.endif
104
105
# Here we try to define some generic ways of testing that may work with many
106
# ports
107
108
# The bulk of GNU configure scripts use a check target, inspired by
109
# automake or autotest.
110
.if defined(GNU_CONFIGURE)
111
TEST_TARGET?=	check
112
.else
113
TEST_TARGET?=	test
114
.endif
115
.if defined(USE_GMAKE)
116
_TEST_MAKE=	${GMAKE}
117
.else
118
_TEST_MAKE=	${MAKE}
119
.endif
120
121
# Try to use build in Perl tests for Perl ports
122
.if defined(PERL_CONFIGURE) ||defined(PERL_MODBUILD)
123
TEST_ADD_RUNDEPS=	yes
124
# Build.pl tests run slightly differently
125
.if defined(PERL_MODBUILD)
126
_TEST_MAKE=	${PERL5} ${PL_BUILD}
127
.endif # PERL_MODBUILD
128
# Multiple test jobs support for Perl
129
.if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
130
TEST_JOBS_NUMBER=	# empty
131
.else
132
.if defined(MAKE_JOBS_SAFE) || defined(FORCE_MAKE_JOBS)
133
TEST_JOBS_NUMBER?=	`${SYSCTL} -n kern.smp.cpus`
134
TEST_ENV+=	HARNESS_OPTIONS=j${TEST_JOBS_NUMBER}
135
.endif # MAKE_JOBS_SAFE or FORCE_MAKE_JOBS
136
.endif # DISABLE_MAKE_JOBS or MAKE_JOBS_UNSAFE
137
.endif # PERL_CONFIGURE or PERL_MODBUILD
138
139
# TODO: add additional generic testing support here
140
141
.if defined(TEST_ADD_RUNDEPS)
142
TEST_DEPENDS+=	${RUN_DEPENDS}
143
.endif
144
145
.if defined(TEST_DEPENDS)
146
BUILD_DEPENDS+=	${TEST_DEPENDS}
147
.endif
148
149
.if defined(TEST_FAIL_OK)
150
_TEST_OK=	||true
151
.else
152
_TEST_OK=	#empty
153
.endif
154
155
.endif # !_TESTMKINCLUDED
156
157
.if defined(_POSTMKINCLUDED) && defined(_TESTMKINCLUDED)
158
.if !target(test-message)
159
test-message:
160
.if defined(TEST_INTERACTIVE) && defined(BATCH)
161
	@${ECHO_MSG} "===>  Skipping interactive tests"
162
.elif defined(TEST_REQUIRE_LOCALHOST) && ${_TEST_IS_JAILED} == 1
163
	@${ECHO_MSG} "===>  Skipping tests: requires localhost and we are jailed"
164
.elif defined(TEST_REQUIRE_RAW_SOCKETS) && ${_TEST_IS_JAILED} == 1
165
	@${ECHO_MSG} "===>  Skipping tests: requires raw sockets and we are jailed"
166
.elif defined(TEST_REQUIRE_NETWORKING) && defined(WITHOUT_NETWORKED_TESTS)
167
	@${ECHO_MSG} "===>  Skipping tests: ${TEST_REQUIRE_NETWORKING}"
168
.elif defined(NO_TEST)
169
	@${ECHO_MSG} "===>  Skipping tests: ${NO_TEST}"
170
.else
171
	@${ECHO_MSG} "===>  Testing for ${PKGNAME}"
172
.endif
173
.if !defined(USE_TESTS)
174
	@${ECHO_MSG} "WARNING: USE_TESTS not set in ${PKGORIGIN}/Makefile"
175
.endif
176
.endif
177
178
.if !target(test-rm-broken)
179
test-rm-broken:
180
.if defined(TEST_BROKEN_TESTS)
181
	@${ECHO_MSG} "===>   Removing tests that may hang the test process:"
182
.for test in ${TEST_BROKEN_TESTS}
183
	@${ECHO_MSG} "        ${test}"
184
	@${RM} ${WRKSRC}/${test}
185
.endfor
186
.else
187
	@${DO_NADA}
188
.endif # !defined TEST_BROKEN_TESTS
189
.endif # !target
190
191
# Can be used by port to see if any conditions apply that are not handled
192
# gracefully by upstream test, like being jailed or having a running instance
193
# of the program (databases/virtuoso for example).
194
.if !target(pre-test)
195
pre-test:
196
	@${DO_NADA}
197
198
.endif
199
200
# The real thing(tm)
201
# Override this in Makefile if you really need something special.
202
.if !target(do-test)
203
do-test:
204
.for dir in ${TEST_DIRS}
205
.if !defined(TEST_SCRIPT)
206
	@cd ${WRKSRC}/${dir} && ${SETENV} ${MAKE_ENV} ${TEST_ENV} ${_TEST_MAKE} \
207
		${TEST_TARGET} ${_TEST_OK}
208
.else
209
	@cd ${WRKSRC}/${dir} && ${SETENV} ${SCRIPTS_ENV} ${TEST_ENV} \
210
		${TEST_SCRIPT} ${TEST_SCRIPT_ARGS} ${_TEST_OK}
211
.endif # !TEST_SCRIPT
212
.endfor # test dirs
213
.endif # !target(do-test)
214
215
# Can be used by port to do clean ups or mail test results.
216
.if !target(post-test)
217
post-test:
218
	@${DO_NADA}
219
.endif
220
221
.if !target(test-results-message)
222
test-results-message:
223
.if defined(TEST_FAIL_OK)
224
	@${ECHO_CMD}
225
	@${ECHO_MSG} "===>   Test may have failed because:"
226
	@${ECHO_CMD}; ${ECHO_MSG} "${TEST_FAIL_OK}"; ${ECHO_CMD}
227
.endif
228
	@${ECHO_CMD} "===>  Testing completed for ${PKGNAME}"
229
.endif
230
231
.if !target(retest)
232
retest:
233
	-@${RM} ${TEST_COOKIE}
234
	@cd ${.CURDIR} && ${MAKE} test
235
.endif
236
237
.endif # defined(_POSTMKINCLUDED) && defined(_TESTMKINCLUDED)

Return to bug 164896