Module Name:    src
Committed By:   rillig
Date:           Mon Nov 30 20:12:29 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: cond-func-exists.mk

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


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/cond-func-exists.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/cond-func-exists.mk
diff -u src/usr.bin/make/unit-tests/cond-func-exists.mk:1.5 src/usr.bin/make/unit-tests/cond-func-exists.mk:1.6
--- src/usr.bin/make/unit-tests/cond-func-exists.mk:1.5	Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/cond-func-exists.mk	Mon Nov 30 20:12:29 2020
@@ -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:
 	@:;

Reply via email to