Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make/unit-tests make: meta-ignore tests will not wor...
details: https://anonhg.NetBSD.org/src/rev/acaaa64092df
branches: trunk
changeset: 373753:acaaa64092df
user: sjg <sjg%NetBSD.org@localhost>
date: Sat Feb 25 19:30:32 2023 +0000
description:
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.
diffstat:
usr.bin/make/unit-tests/Makefile | 37 +++++----
usr.bin/make/unit-tests/meta-ignore.inc | 16 ++-
usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp | 4 +-
usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp | 4 +-
usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp | 4 +-
5 files changed, 34 insertions(+), 31 deletions(-)
diffs (164 lines):
diff -r 519133002752 -r acaaa64092df usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile Sat Feb 25 19:24:07 2023 +0000
+++ b/usr.bin/make/unit-tests/Makefile Sat Feb 25 19:30:32 2023 +0000
@@ -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-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 @@
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
diff -r 519133002752 -r acaaa64092df usr.bin/make/unit-tests/meta-ignore.inc
--- a/usr.bin/make/unit-tests/meta-ignore.inc Sat Feb 25 19:24:07 2023 +0000
+++ b/usr.bin/make/unit-tests/meta-ignore.inc Sat Feb 25 19:30:32 2023 +0000
@@ -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 @@
@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 @@
.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}/*
diff -r 519133002752 -r acaaa64092df usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp
--- a/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp Sat Feb 25 19:24:07 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_filter.exp Sat Feb 25 19:30:32 2023 +0000
@@ -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
diff -r 519133002752 -r acaaa64092df usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp
--- a/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp Sat Feb 25 19:24:07 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_paths.exp Sat Feb 25 19:30:32 2023 +0000
@@ -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
diff -r 519133002752 -r acaaa64092df usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp
--- a/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp Sat Feb 25 19:24:07 2023 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-make-meta-ignore_patterns.exp Sat Feb 25 19:30:32 2023 +0000
@@ -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
Home |
Main Index |
Thread Index |
Old Index