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(1): add test for directory cach...



details:   https://anonhg.NetBSD.org/src/rev/bba4d95196fe
branches:  trunk
changeset: 946539:bba4d95196fe
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 30 20:12:29 2020 +0000

description:
make(1): add test for directory cache and exists()

diffstat:

 usr.bin/make/unit-tests/cond-func-exists.mk |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (24 lines):

diff -r 589982a3f5a4 -r bba4d95196fe usr.bin/make/unit-tests/cond-func-exists.mk
--- a/usr.bin/make/unit-tests/cond-func-exists.mk       Mon Nov 30 18:49:58 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-exists.mk       Mon Nov 30 20:12:29 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-func-exists.mk,v 1.5 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-func-exists.mk,v 1.6 2020/11/30 20:12:29 rillig Exp $
 #
 # Tests for the exists() function in .if conditions.
 
@@ -38,5 +38,14 @@
 .  error
 .endif
 
+# The exists function does not really look up the file in the file system,
+# instead it uses a cache that is preloaded very early, before parsing the
+# first makefile.  At that time, the file did not exist yet.
+_!=    > cond-func-exists.just-created
+.if exists(cond-func-exists.just-created)
+.  error
+.endif
+_!=    rm cond-func-exists.just-created
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index