Module Name: src
Committed By: sjg
Date: Thu Feb 23 05:20:45 UTC 2023
Modified Files:
src/usr.bin/make/unit-tests: Makefile
varname-dot-make-meta-ignore_filter.exp
varname-dot-make-meta-ignore_filter.mk
varname-dot-make-meta-ignore_paths.exp
varname-dot-make-meta-ignore_paths.mk
varname-dot-make-meta-ignore_patterns.exp
varname-dot-make-meta-ignore_patterns.mk
Log Message:
Add unit-tests for .MAKE.META.IGNORE_*
These unit-tests should only be run if TEST_MAKE
has a valid .MAKE.PATH_FILEMON to indicate that filemon is
supported.
All three tests use the same meta-ignore.inc
which runs three sub-makes
one to initialize the target .meta file
two to ignore a file using .MAKE.META.IGNORE_{PATHS,PATTERNS,FILTER}
three to verify that without .MAKE.META.IGNORE_* the target is out of date.
Fix the order of _SED_CMDS to avoid errors when ${MAKE:T} appears in
.OBJDIR
To generate a diff of this commit:
cvs rdiff -u -r1.331 -r1.332 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp
cvs rdiff -u -r1.2 -r1.3 \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk \
src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.331 src/usr.bin/make/unit-tests/Makefile:1.332
--- src/usr.bin/make/unit-tests/Makefile:1.331 Tue Jan 24 00:24:02 2023
+++ src/usr.bin/make/unit-tests/Makefile Thu Feb 23 05:20:45 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.331 2023/01/24 00:24:02 sjg Exp $
+# $NetBSD: Makefile,v 1.332 2023/02/23 05:20:45 sjg Exp $
#
# Unit tests for make(1)
#
@@ -405,12 +405,14 @@ TESTS+= varname-dot-make-makefiles
TESTS+= varname-dot-make-meta-bailiwick
TESTS+= varname-dot-make-meta-created
TESTS+= varname-dot-make-meta-files
+.if ${.MAKE.PATH_FILEMON:Uno:Nktrace:N/dev*} == ""
TESTS+= varname-dot-make-meta-ignore_filter
TESTS+= varname-dot-make-meta-ignore_paths
TESTS+= varname-dot-make-meta-ignore_patterns
+TESTS+= varname-dot-make-path_filemon
+.endif
TESTS+= varname-dot-make-meta-prefix
TESTS+= varname-dot-make-mode
-TESTS+= varname-dot-make-path_filemon
TESTS+= varname-dot-make-pid
TESTS+= varname-dot-make-ppid
TESTS+= varname-dot-make-save_dollars
@@ -501,6 +503,10 @@ SED_CMDS.job-output-long-lines= \
${:D marker should always be at the beginning of the line. } \
-e '/^aa*--- job-b ---$$/d' \
-e '/^bb*--- job-a ---$$/d'
+
+# meta line numbers can vary based on filemon implementation
+SED_CMDS.meta-ignore= -e 's,\(\.meta:\) [1-9][0-9]*:,\1 <line>:,'
+
SED_CMDS.opt-chdir= -e 's,\(nonexistent\).[1-9][0-9]*,\1,'
SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1}
SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2}
@@ -533,6 +539,9 @@ SED_CMDS.var-op-shell+= -e '/command/s,
SED_CMDS.vardebug+= -e 's,${.SHELL},</path/to/shell>,'
SED_CMDS.varmod-subst-regex+= ${STD_SED_CMDS.regex}
SED_CMDS.varparse-errors+= ${STD_SED_CMDS.timestamp}
+SED_CMDS.varname-dot-make-meta-ignore_filter+= ${SED_CMDS.meta-ignore}
+SED_CMDS.varname-dot-make-meta-ignore_paths+= ${SED_CMDS.meta-ignore}
+SED_CMDS.varname-dot-make-meta-ignore_patterns+= ${SED_CMDS.meta-ignore}
SED_CMDS.varname-dot-parsedir= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
SED_CMDS.varname-dot-parsefile= -e '/in some cases/ s,^make: "[^"]*,make: "<normalized>,'
SED_CMDS.varname-dot-shell= -e 's, = /[^ ]*, = (details omitted),g'
@@ -713,23 +722,23 @@ LIMIT_RESOURCES?= :
# Postprocess the test output to make the output platform-independent.
#
-# always pretend .MAKE was called 'make'
-_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
-_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
-_SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
-# replace anything after 'stopped in' with unit-tests
+# Replace anything after 'stopped in' with unit-tests
_SED_CMDS+= -e '/stopped/s, /.*, unit-tests,'
# Allow the test files to be placed anywhere.
_SED_CMDS+= -e 's,\(\.PARSEDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
_SED_CMDS+= -e 's,\(\.INCLUDEDFROMDIR}\) = `'"/[^']*'"',\1 = <some-dir>,'
-_SED_CMDS+= -e 's,${TMPDIR},<tmpdir>,g'
+_SED_CMDS+= -e 's,${TMPDIR},<tmpdir>,g' -e 's,${TMPDIR:tA},<tmpdir>,g'
# canonicalize ${.OBJDIR} and ${.CURDIR}
+_SED_CMDS+= -e 's,${.CURDIR},<curdir>,g'
.if ${.OBJDIR} != ${.CURDIR}
# yes this is inaccurate but none of the tests expect <objdir> anywhere
# which we get depending on how MAKEOBJDIR is set.
-_SED_CMDS+= -e 's,${.OBJDIR},<curdir>,g'
+_SED_CMDS+= -e 's,${.OBJDIR},<curdir>,g' -e 's,${.OBJDIR:tA},<curdir>,g'
.endif
-_SED_CMDS+= -e 's,${.CURDIR},<curdir>,g'
+# always pretend .MAKE was called 'make'
+_SED_CMDS+= -e 's,^${TEST_MAKE:T:S,.,\\.,g}[][0-9]*:,make:,'
+_SED_CMDS+= -e 's,${TEST_MAKE:S,.,\\.,g},make,'
+_SED_CMDS+= -e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
_SED_CMDS+= -e 's,<curdir>/,,g'
_SED_CMDS+= -e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'
_SED_CMDS+= -e '/MAKE_VERSION/d'
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp:1.1 Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp Thu Feb 23 05:20:45 2023
@@ -1 +1,11 @@
+Initialize check-ignore.meta
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
+Use .MAKE.META.IGNORE_* - check-ignore is up to date
+`check-ignore' is up to date.
+Skipping meta for .END: .SPECIAL
+Skip .MAKE.META.IGNORE_* - check-ignore is out of date
+<tmpdir>/obj/check-ignore.meta: <line>: file '<tmpdir>/ignore/check' is newer than the target...
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
exit status 0
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp:1.1 Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp Thu Feb 23 05:20:45 2023
@@ -1 +1,11 @@
+Initialize check-ignore.meta
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
+Use .MAKE.META.IGNORE_* - check-ignore is up to date
+`check-ignore' is up to date.
+Skipping meta for .END: .SPECIAL
+Skip .MAKE.META.IGNORE_* - check-ignore is out of date
+<tmpdir>/obj/check-ignore.meta: <line>: file '<tmpdir>/ignore/check' is newer than the target...
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
exit status 0
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp:1.1 Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp Thu Feb 23 05:20:45 2023
@@ -1 +1,11 @@
+Initialize check-ignore.meta
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
+Use .MAKE.META.IGNORE_* - check-ignore is up to date
+`check-ignore' is up to date.
+Skipping meta for .END: .SPECIAL
+Skip .MAKE.META.IGNORE_* - check-ignore is out of date
+<tmpdir>/obj/check-ignore.meta: <line>: file '<tmpdir>/ignore/check' is newer than the target...
+Building <tmpdir>/obj/check-ignore
+Skipping meta for .END: .SPECIAL
exit status 0
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.mk Thu Feb 23 05:20:45 2023
@@ -1,8 +1,5 @@
-# $NetBSD: varname-dot-make-meta-ignore_filter.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-make-meta-ignore_filter.mk,v 1.3 2023/02/23 05:20:45 sjg Exp $
#
# Tests for the special .MAKE.META.IGNORE_FILTER variable.
-# TODO: Implementation
-
-all:
- @:;
+.include "meta-ignore.inc"
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.mk Thu Feb 23 05:20:45 2023
@@ -1,8 +1,5 @@
-# $NetBSD: varname-dot-make-meta-ignore_paths.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-make-meta-ignore_paths.mk,v 1.3 2023/02/23 05:20:45 sjg Exp $
#
# Tests for the special .MAKE.META.IGNORE_PATHS variable.
-# TODO: Implementation
-
-all:
- @:;
+.include "meta-ignore.inc"
Index: src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.mk Thu Feb 23 05:20:45 2023
@@ -1,8 +1,5 @@
-# $NetBSD: varname-dot-make-meta-ignore_patterns.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-make-meta-ignore_patterns.mk,v 1.3 2023/02/23 05:20:45 sjg Exp $
#
# Tests for the special .MAKE.META.IGNORE_PATTERNS variable.
-# TODO: Implementation
-
-all:
- @:;
+.include "meta-ignore.inc"