pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk New target test-env, like build-env and configure-env.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/360fa5745a8f
branches:  trunk
changeset: 413909:360fa5745a8f
user:      riastradh <riastradh%pkgsrc.org@localhost>
date:      Mon Mar 23 00:33:48 2020 +0000

description:
New target test-env, like build-env and configure-env.

diffstat:

 mk/bsd.pkg.barrier.mk |   4 ++--
 mk/build/test.mk      |  37 +++++++++++++++++++++++++++++++++++--
 2 files changed, 37 insertions(+), 4 deletions(-)

diffs (79 lines):

diff -r 01d68b06fc1f -r 360fa5745a8f mk/bsd.pkg.barrier.mk
--- a/mk/bsd.pkg.barrier.mk     Sun Mar 22 23:39:13 2020 +0000
+++ b/mk/bsd.pkg.barrier.mk     Mon Mar 23 00:33:48 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.barrier.mk,v 1.20 2020/02/09 20:33:38 rillig Exp $
+# $NetBSD: bsd.pkg.barrier.mk,v 1.21 2020/03/23 00:33:48 riastradh Exp $
 
 _COOKIE.barrier=       ${WRKDIR}/.barrier_cookie
 
@@ -20,7 +20,7 @@
 _BARRIER_POST_TARGETS+=        patch
 _BARRIER_POST_TARGETS+=        configure configure-env
 _BARRIER_POST_TARGETS+=        build build-env
-_BARRIER_POST_TARGETS+=        test
+_BARRIER_POST_TARGETS+=        test test-env
 _BARRIER_POST_TARGETS+=        all
 _BARRIER_POST_TARGETS+=        stage-install
 _BARRIER_POST_TARGETS+=        stage-package-create
diff -r 01d68b06fc1f -r 360fa5745a8f mk/build/test.mk
--- a/mk/build/test.mk  Sun Mar 22 23:39:13 2020 +0000
+++ b/mk/build/test.mk  Mon Mar 23 00:33:48 2020 +0000
@@ -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 @@
 .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}



Home | Main Index | Thread Index | Old Index