Module Name:    src
Committed By:   rillig
Date:           Sat Jun  1 11:06:17 UTC 2024

Modified Files:
        src/usr.bin/make/unit-tests: varname-dot-objdir.exp
            varname-dot-objdir.mk

Log Message:
tests/make: cover purging the realpath cache

In purge_relative_cached_realpaths, the hash table containing the cache
is modified while being iterated, which needs extra care, so add a test
that covers this code in at least a single simple scenario.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-objdir.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/varname-dot-objdir.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/varname-dot-objdir.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.1 src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.2
--- src/usr.bin/make/unit-tests/varname-dot-objdir.exp:1.1	Sun Aug 16 12:07:52 2020
+++ src/usr.bin/make/unit-tests/varname-dot-objdir.exp	Sat Jun  1 11:06:17 2024
@@ -1 +1,2 @@
+: purge-cache was reached.
 exit status 0

Index: src/usr.bin/make/unit-tests/varname-dot-objdir.mk
diff -u src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.2 src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.3
--- src/usr.bin/make/unit-tests/varname-dot-objdir.mk:1.2	Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/varname-dot-objdir.mk	Sat Jun  1 11:06:17 2024
@@ -1,8 +1,15 @@
-# $NetBSD: varname-dot-objdir.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-objdir.mk,v 1.3 2024/06/01 11:06:17 rillig Exp $
 #
 # Tests for the special .OBJDIR variable.
 
 # TODO: Implementation
 
 all:
-	@:;
+	# Add an entry to the cached_realpath table, to test cleaning up
+	# that table in purge_relative_cached_realpaths.
+	# Having a ':=' assignment in the command line is construed but works
+	# well enough to reach the code.
+	@${MAKE} -f ${MAKEFILE} 'VAR:=$${:U.:tA}' purge-cache
+
+purge-cache:
+	: ${.TARGET} was reached.

Reply via email to