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 debug log for ...



details:   https://anonhg.NetBSD.org/src/rev/bfe70ff54fe6
branches:  trunk
changeset: 956513:bfe70ff54fe6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Oct 31 21:30:03 2020 +0000

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

diffstat:

 usr.bin/make/unit-tests/dir.exp |  31 +++++++++++++++++++++++++++++++
 usr.bin/make/unit-tests/dir.mk  |  35 ++++++++++++++++++++++++++++++++++-
 2 files changed, 65 insertions(+), 1 deletions(-)

diffs (96 lines):

diff -r 07d90a9bb75e -r bfe70ff54fe6 usr.bin/make/unit-tests/dir.exp
--- a/usr.bin/make/unit-tests/dir.exp   Sat Oct 31 21:12:36 2020 +0000
+++ b/usr.bin/make/unit-tests/dir.exp   Sat Oct 31 21:30:03 2020 +0000
@@ -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
diff -r 07d90a9bb75e -r bfe70ff54fe6 usr.bin/make/unit-tests/dir.mk
--- a/usr.bin/make/unit-tests/dir.mk    Sat Oct 31 21:12:36 2020 +0000
+++ b/usr.bin/make/unit-tests/dir.mk    Sat Oct 31 21:30:03 2020 +0000
@@ -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 @@
 
 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



Home | Main Index | Thread Index | Old Index