git: d7700ff7fde6 - main - Framework: Introduce testing feature

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Thu, 29 Feb 2024 06:08:13 UTC
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d7700ff7fde6e68207ee20008430ee59ba5759e8

commit d7700ff7fde6e68207ee20008430ee59ba5759e8
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-02-17 16:15:04 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-02-29 06:07:11 +0000

    Framework: Introduce testing feature
    
    Setting WITH_TESTING=yes will cause running `make test` between `stage` and
    `package` in the default pipeline.
    
    This feature is off by default.
    
    Sponsored by:   Serenity Cybersecurity, LLC
---
 Mk/Features/testing.mk | 15 +++++++++++++++
 Mk/bsd.port.mk         |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/Mk/Features/testing.mk b/Mk/Features/testing.mk
new file mode 100644
index 000000000000..15af7e28eb7c
--- /dev/null
+++ b/Mk/Features/testing.mk
@@ -0,0 +1,15 @@
+# Automatic testing Support
+#
+# Add WITH_TESTING=yes into make.conf:
+# - If set, and the port supports it, the software's test suite will be compiled
+#   and run during the normal building pipeline between 'stage' and 'package'
+#   stages.
+
+.if !defined(_TESTING_MK_INCLUDED)
+_TESTING_MK_INCLUDED=	yes
+TESTING_Include_MAINTAINER=	portmgr@FreeBSD.org
+
+_TESTING_PACKAGE_DEP=	test
+
+.endif
+
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 5258bcfeb55b..32baeb54b242 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -1013,7 +1013,7 @@ LC_ALL=		C
 # These need to be absolute since we don't know how deep in the ports
 # tree we are and thus can't go relative.  They can, of course, be overridden
 # by individual Makefiles or local system make configuration.
-_LIST_OF_WITH_FEATURES=	bind_now debug debuginfo lto pie relro sanitize ssp
+_LIST_OF_WITH_FEATURES=	bind_now debug debuginfo lto pie relro sanitize ssp testing
 _DEFAULT_WITH_FEATURES=	ssp
 PORTSDIR?=		/usr/ports
 LOCALBASE?=		/usr/local
@@ -5490,7 +5490,7 @@ _INSTALL_SEQ=	100:install-message \
 				300:create-manifest
 _INSTALL_SUSEQ=	400:fake-pkg 500:security-check
 
-_PACKAGE_DEP=	stage
+_PACKAGE_DEP=	stage ${_TESTING_PACKAGE_DEP}
 _PACKAGE_SEQ=	100:package-message 300:pre-package 450:pre-package-script \
 				500:do-package 850:post-package-script \
 				${_OPTIONS_package} ${_USES_package}