Module Name: src Committed By: sjg Date: Sat Feb 25 19:30:32 UTC 2023
Modified Files: src/usr.bin/make/unit-tests: Makefile meta-ignore.inc varname-dot-make-meta-ignore_filter.exp varname-dot-make-meta-ignore_paths.exp varname-dot-make-meta-ignore_patterns.exp Log Message: make: meta-ignore tests will not work if TMPDIR is /tmp Since /tmp and /var/tmp are always part of .MAKE.META.IGNORE_PATHS the varname-dot-make-meta-ignore_* tests will not work if TMPDIR is either (or subdir) of those. To generate a diff of this commit: cvs rdiff -u -r1.332 -r1.333 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/meta-ignore.inc cvs rdiff -u -r1.2 -r1.3 \ 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 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.332 src/usr.bin/make/unit-tests/Makefile:1.333 --- src/usr.bin/make/unit-tests/Makefile:1.332 Thu Feb 23 05:20:45 2023 +++ src/usr.bin/make/unit-tests/Makefile Sat Feb 25 19:30:32 2023 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.332 2023/02/23 05:20:45 sjg Exp $ +# $NetBSD: Makefile,v 1.333 2023/02/25 19:30:32 sjg Exp $ # # Unit tests for make(1) # @@ -33,6 +33,21 @@ .MAKE.OS?= ${uname -s:L:sh} .MAKE.UID?= ${id -u:L:sh} +# for many tests we need a TMPDIR that will not collide +# with other users. +.if ${.OBJDIR} != ${.CURDIR} +# easy +TMPDIR:= ${.OBJDIR}/tmp +.elif defined(TMPDIR) +TMPDIR:= ${TMPDIR}/uid${.MAKE.UID} +.else +TMPDIR:= /tmp/uid${.MAKE.UID} +.endif +# make sure it exists +.if !exist(${TMPDIR}) +_!= mkdir -p ${TMPDIR} +.endif + # Each test is in a sub-makefile. # Keep the list sorted. # Any test that is commented out must be ignored in @@ -405,7 +420,9 @@ 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*} == "" +.if ${.MAKE.PATH_FILEMON:Uno:Nktrace:N/dev*} == "" && ${TMPDIR:N/tmp*:N/var/tmp*} != "" +# these tests will not work if TMPDIR is or is a subdir of +# /tmp or /var/tmp TESTS+= varname-dot-make-meta-ignore_filter TESTS+= varname-dot-make-meta-ignore_paths TESTS+= varname-dot-make-meta-ignore_patterns @@ -667,22 +684,6 @@ LC_ALL= C LANG= C .export LANG LC_ALL - -# for many tests we need a TMPDIR that will not collide -# with other users. -.if ${.OBJDIR} != ${.CURDIR} -# easy -TMPDIR:= ${.OBJDIR}/tmp -.elif defined(TMPDIR) -TMPDIR:= ${TMPDIR}/uid${.MAKE.UID} -.else -TMPDIR:= /tmp/uid${.MAKE.UID} -.endif -# make sure it exists -.if !exist(${TMPDIR}) -_!= mkdir -p ${TMPDIR} -.endif - # Some Linux systems such as Fedora have deprecated egrep in favor of grep -E. .if ${.MAKE.OS:NLinux} == "" EGREP= grep -E Index: src/usr.bin/make/unit-tests/meta-ignore.inc diff -u src/usr.bin/make/unit-tests/meta-ignore.inc:1.1 src/usr.bin/make/unit-tests/meta-ignore.inc:1.2 --- src/usr.bin/make/unit-tests/meta-ignore.inc:1.1 Thu Feb 23 05:21:27 2023 +++ src/usr.bin/make/unit-tests/meta-ignore.inc Sat Feb 25 19:30:32 2023 @@ -1,9 +1,11 @@ -# $NetBSD: meta-ignore.inc,v 1.1 2023/02/23 05:21:27 sjg Exp $ +# $NetBSD: meta-ignore.inc,v 1.2 2023/02/25 19:30:32 sjg Exp $ # common logic for testing .MAKE.META.IGNORE_* # we want a directory outside of .OBJDIR to drop a file # that our meta file refers to. +# Note: these tests will not work if TMPDIR is /tmp or /var/tmp +# or a subdir thereof IGNORE:= ${TMPDIR}/ignore OBJ:= ${TMPDIR}/obj @@ -18,11 +20,11 @@ setup: @rm -f ${OBJ}/check-ignore makefile:= ${.INCLUDEDFROMDIR}/${.INCLUDEDFROMFILE} -TEST:= ${.INCLUDEDFROMFILE:R} +TEST:= ${.INCLUDEDFROMFILE:R:C,.*meta-,,:S,-,_,g:tu} DESC.one= Initialize check-ignore.meta -DESC.two= Use .MAKE.META.IGNORE_* - check-ignore is up to date -DESC.three= Skip .MAKE.META.IGNORE_* - check-ignore is out of date +DESC.two= Use .MAKE.META.${TEST} - check-ignore is up to date +DESC.three= Skip .MAKE.META.${TEST} - check-ignore is out of date # just in case someone runs us with -jN .ORDER: one two three @@ -35,16 +37,16 @@ one two three: .MAKE setup .MAKE.MODE = meta verbose silent=yes .OBJDIR: ${OBJ} .if ${parent} == "two" -.if ${TEST:M*ignore_paths} != "" +.if ${TEST} == "IGNORE_PATHS" # this is a prefix list - any path that matches # one of these prefixes will be ignored .MAKE.META.IGNORE_PATHS = ${IGNORE} -.elif ${TEST:M*ignore_patterns} != "" +.elif ${TEST} == "IGNORE_PATTERNS" # more flexible but more expensive # this example is equivalent to M*/ignore/* # a match means ignore .MAKE.META.IGNORE_PATTERNS = */ignore/* -.elif ${TEST:M*ignore_filter} != "" +.elif ${TEST} == "IGNORE_FILTER" # this is the most flexible, but also most expensive # if this expands to nothing - ignore the path .MAKE.META.IGNORE_FILTER = N${IGNORE}/* 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.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp:1.3 --- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp:1.2 Thu Feb 23 05:20:45 2023 +++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp Sat Feb 25 19:30:32 2023 @@ -1,10 +1,10 @@ Initialize check-ignore.meta Building <tmpdir>/obj/check-ignore Skipping meta for .END: .SPECIAL -Use .MAKE.META.IGNORE_* - check-ignore is up to date +Use .MAKE.META.IGNORE_FILTER - 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 +Skip .MAKE.META.IGNORE_FILTER - 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 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.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp:1.3 --- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp:1.2 Thu Feb 23 05:20:45 2023 +++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp Sat Feb 25 19:30:32 2023 @@ -1,10 +1,10 @@ Initialize check-ignore.meta Building <tmpdir>/obj/check-ignore Skipping meta for .END: .SPECIAL -Use .MAKE.META.IGNORE_* - check-ignore is up to date +Use .MAKE.META.IGNORE_PATHS - 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 +Skip .MAKE.META.IGNORE_PATHS - 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 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.2 src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp:1.3 --- src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp:1.2 Thu Feb 23 05:20:45 2023 +++ src/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp Sat Feb 25 19:30:32 2023 @@ -1,10 +1,10 @@ Initialize check-ignore.meta Building <tmpdir>/obj/check-ignore Skipping meta for .END: .SPECIAL -Use .MAKE.META.IGNORE_* - check-ignore is up to date +Use .MAKE.META.IGNORE_PATTERNS - 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 +Skip .MAKE.META.IGNORE_PATTERNS - 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