diff options
author | riastradh <riastradh@pkgsrc.org> | 2020-03-23 00:33:48 +0000 |
---|---|---|
committer | riastradh <riastradh@pkgsrc.org> | 2020-03-23 00:33:48 +0000 |
commit | 34da0429b1b85ba439e4c386f94ebb09ba508f14 (patch) | |
tree | 2cb30036689af26761b7bb6adfab81d43e64b3a1 /mk/build | |
parent | 51b2e4a8d42f8273bba99f95a708c9d8166a020a (diff) | |
download | pkgsrc-34da0429b1b85ba439e4c386f94ebb09ba508f14.tar.gz |
New target test-env, like build-env and configure-env.
Diffstat (limited to 'mk/build')
-rw-r--r-- | mk/build/test.mk | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/mk/build/test.mk b/mk/build/test.mk index dcbe9e64c80..a103f423fd3 100644 --- a/mk/build/test.mk +++ b/mk/build/test.mk @@ -1,10 +1,16 @@ -# $NetBSD: test.mk,v 1.23 2019/10/13 11:08:10 rillig Exp $ +# $NetBSD: test.mk,v 1.24 2020/03/23 00:33:48 riastradh Exp $ # # After the "build" phase, many packages provide some sort of self-test # that can be run on the not-yet installed package. To enable these # tests, the package must define TEST_TARGET or override the do-test # target. Additionally, the pkgsrc user must define PKGSRC_RUN_TEST. # +# Public targets for developers: +# +# test-env: +# Runs an interactive shell (TEST_ENV_SHELL) in the environment +# that is used for testing the package. +# # User-settable variables: # # PKGSRC_RUN_TEST @@ -39,7 +45,7 @@ # _VARGROUPS+= test -_USER_VARS.test= PKGSRC_RUN_TEST +_USER_VARS.test= PKGSRC_RUN_TEST TEST_ENV_SHELL _PKG_VARS.test= TEST_TARGET TEST_DIRS TEST_ENV TEST_MAKE_FLAGS _USE_VARS.test= BUILD_DIRS MAKE_ENV MAKE_FLAGS MAKEFLAGS MAKE_FILE \ RECURSIVE_MAKE INTERACTIVE_STAGE BATCH WRKSRC @@ -188,3 +194,30 @@ test-cookie: .PHONY: test-clean test-clean: ${RUN} ${RM} -f ${_COOKIE.test} + +# test-env: +# Runs an interactive shell in the same environment that is +# also used for the tests. +# +# This is only used during development and testing of a package +# to work in the same environment as the actual test. +# +# User-settable variables: +# +# TEST_ENV_SHELL +# The shell to start. +# +# Default: ${SH} +# +# Keywords: debug test + +TEST_ENV_SHELL?= ${SH} +test-env: .PHONY ${_PKGSRC_BARRIER:Ubarrier:D_test-env} +_test-env: .PHONY wrapper + @${STEP_MSG} "Entering the test environment for ${PKGNAME}" +.if ${TEST_DIRS:[#]} > 1 || ${TEST_DIRS} != ${WRKSRC} + @${ECHO_MSG} "The TEST_DIRS are:" \ + ${TEST_DIRS:S,^${WRKSRC}$,.,:S,^${WRKSRC}/,,:Q} +.endif + ${RUN} cd ${WRKSRC} \ + && ${PKGSRC_SETENV} ${TEST_ENV} ${TEST_ENV_SHELL} |