git: a1c9248d20bb - stable/14 - Remove Dtrace/ZFS tests if their knobs are disabled

From: Enji Cooper <ngie_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 02:08:00 UTC
The branch stable/14 has been updated by ngie:

URL: https://cgit.FreeBSD.org/src/commit/?id=a1c9248d20bbe0316c4f34cdf98c1d7e0d27c1a2

commit a1c9248d20bbe0316c4f34cdf98c1d7e0d27c1a2
Author:     Enji Cooper <ngie@FreeBSD.org>
AuthorDate: 2026-09-22 02:27:04 +0000
Commit:     Enji Cooper <ngie@FreeBSD.org>
CommitDate: 2026-11-23 02:06:47 +0000

    Remove Dtrace/ZFS tests if their knobs are disabled
    
    Prior to this change, Dtrace and ZFS tests and their respective
    directories would remain installed even if `${MK_DTRACE_TESTS}` == no or
    `${MK_ZFS_TESTS}` == no.
    
    This change enhances the logic to remove the tests when the respective
    knobs are disabled so the tests will be removed when `make delete-old`
    is run.
    
    MFC after:      2 weeks
    
    (cherry picked from commit 30c20ca26e105cffc5f37a95964cd9b2cad1b6cd)
---
 tools/build/mk/OptionalObsoleteFiles.inc | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 15e9d619fdb3..a4ccaadf7037 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -1715,6 +1715,18 @@ OLD_DIRS+=usr/share/dtrace/toolkit
 OLD_DIRS+=usr/share/dtrace
 .endif
 
+.if ${MK_DTRACE_TESTS} == no
+DTRACE_TEST_DIRS=	cddl/usr.sbin/dtrace
+. for d in ${DTRACE_TEST_DIRS}
+.  if exists(${DESTDIR}${TESTSBASE}/${d}/)
+TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
+OLD_DIRS+=${TESTS_DIRS}
+TESTS_FILES!=find ${DESTDIR}${TESTSBASE}/${d}/ -type f | sed -e 's,^${DESTDIR}/,,'; echo
+OLD_FILES+=${TESTS_FILES}
+.  endif
+. endfor
+.endif
+
 .if ${MK_EE} == no
 OLD_FILES+=usr/bin/edit
 OLD_FILES+=usr/bin/ee
@@ -9487,6 +9499,19 @@ OLD_DIRS+=usr/share/zfs/compatibility.d
 OLD_DIRS+=usr/share/zfs
 .endif
 
+.if ${MK_ZFS_TESTS} == no
+ZFS_TEST_DIRS=	cddl/usr.bin/ztest
+ZFS_TEST_DIRS+=	cddl/usr.sbin/zfsd
+. for d in ${ZFS_TEST_DIRS}
+.  if exists(${DESTDIR}${TESTSBASE}/${d}/)
+TESTS_DIRS!=find ${DESTDIR}${TESTSBASE}/${d}/ -type d | sed -e 's,^${DESTDIR}/,,'; echo
+OLD_DIRS+=${TESTS_DIRS}
+TESTS_FILES!=find ${DESTDIR}${TESTSBASE}/${d}/ -type f | sed -e 's,^${DESTDIR}/,,'; echo
+OLD_FILES+=${TESTS_FILES}
+.  endif
+. endfor
+.endif
+
 .if ${MK_ZONEINFO} == no
 OLD_FILES+=usr/share/zoneinfo/Africa/Abidjan
 OLD_FILES+=usr/share/zoneinfo/Africa/Accra