Module Name:    src
Committed By:   rillig
Date:           Sat Oct 31 21:30:03 UTC 2020

Modified Files:
        src/usr.bin/make/unit-tests: dir.exp dir.mk

Log Message:
make(1): add test for debug log for expansion of curly braces


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/dir.exp \
    src/usr.bin/make/unit-tests/dir.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/dir.exp
diff -u src/usr.bin/make/unit-tests/dir.exp:1.6 src/usr.bin/make/unit-tests/dir.exp:1.7
--- src/usr.bin/make/unit-tests/dir.exp:1.6	Sat Oct 31 21:12:36 2020
+++ src/usr.bin/make/unit-tests/dir.exp	Sat Oct 31 21:30:03 2020
@@ -1,3 +1,29 @@
+Searching for .depend ...
+   failed.
+Searching for .depend ...
+   / ...
+   failed.
+Expanding "{one,two,three}"... one two three
+Expanding "f{our,ive}"... four five
+Expanding "{{thi,fou}r,fif}teen"... Expanding "{thi,fou}rteen"... thirteen fourteen
+thirteen fourteen fifteen
+Expanding "{pre-,}{patch,configure}"... Expanding "pre-{patch,configure}"... pre-patch pre-configure
+Expanding "{patch,configure}"... pre-patch pre-configure patch configure
+pre-patch pre-configure patch configure
+Expanding "{fetch,extract}{,-post}"... Expanding "fetch{,-post}"... fetch fetch-post
+Expanding "extract{,-post}"... fetch fetch-post extract extract-post
+fetch fetch-post extract extract-post
+Expanding "dup-{1,1,1,1,1,1,1}"... dup-1 dup-1 dup-1 dup-1 dup-1 dup-1 dup-1
+Expanding "{{{{{{{{{{single-word}}}}}}}}}}"... Expanding "{{{{{{{{{single-word}}}}}}}}}"... Expanding "{{{{{{{{single-word}}}}}}}}"... Expanding "{{{{{{{single-word}}}}}}}"... Expanding "{{{{{{single-word}}}}}}"... Expanding "{{{{{single-word}}}}}"... Expanding "{{{{single-word}}}}"... Expanding "{{{single-word}}}"... Expanding "{{single-word}}"... Expanding "{single-word}"... single-word
+single-word
+single-word
+single-word
+single-word
+single-word
+single-word
+single-word
+single-word
+single-word
 : 1
 : 2
 : 3
@@ -16,4 +42,9 @@
 : extract-post
 : dup-1
 : single-word
+Searching for .END ...
+   failed.
+Searching for .END ...
+   failed.
+Found '.END' as '(not found)'
 exit status 0
Index: src/usr.bin/make/unit-tests/dir.mk
diff -u src/usr.bin/make/unit-tests/dir.mk:1.6 src/usr.bin/make/unit-tests/dir.mk:1.7
--- src/usr.bin/make/unit-tests/dir.mk:1.6	Sat Oct 31 21:12:36 2020
+++ src/usr.bin/make/unit-tests/dir.mk	Sat Oct 31 21:30:03 2020
@@ -1,11 +1,28 @@
-# $NetBSD: dir.mk,v 1.6 2020/10/31 21:12:36 rillig Exp $
+# $NetBSD: dir.mk,v 1.7 2020/10/31 21:30:03 rillig Exp $
 #
 # Tests for dir.c.
 
+.MAKEFLAGS: -m /		# hide /usr/share/mk from the debug log
+
 # Dependency lines may use braces for expansion.
 # See DirExpandCurly for the implementation.
 all: {one,two,three}
 
+# XXX: The above dependency line is parsed as a single node named
+# "{one,two,three}".  There are no individual targets "one", "two", "three"
+# yet.  The node exists but is not a target since it never appeared
+# on the left-hand side of a dependency operator.  However, it is listed
+# in .ALLTARGETS (which lists all nodes, not only targets).
+.if target(one)
+.  error
+.endif
+.if target({one,two,three})
+.  error
+.endif
+.if ${.ALLTARGETS:M{one,two,three}} != "{one,two,three}"
+.  error
+.endif
+
 one:
 	: 1
 two:
@@ -58,3 +75,19 @@ all: {{{{{{{{{{single-word}}}}}}}}}}
 
 single-word:
 	: $@
+
+# Demonstrate debug logging for filename expansion, especially curly braces.
+.MAKEFLAGS: -dd
+# The below line does not call Dir_Expand yet.
+# It is expanded only when necessary, that is, when the 'debug' target is
+# indeed made.
+debug: {{thi,fou}r,fif}twen
+# Therefore, keep the debug logging active.
+
+.PHONY: one two three four five six
+.PHONY: thirteen fourteen fifteen
+.PHONY: single-word
+.PHONY: pre-patch patch pre-configure configure
+.PHONY: fetch fetch-post extract extract-post
+.PHONY: dup-1 single-word
+.PHONY: all

Reply via email to