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 the .ALLTARGET...



details:   https://anonhg.NetBSD.org/src/rev/bcccad636c78
branches:  trunk
changeset: 937762:bcccad636c78
user:      rillig <rillig%NetBSD.org@localhost>
date:      Tue Aug 25 22:51:54 2020 +0000

description:
make(1): add test for the .ALLTARGETS special variable

diffstat:

 usr.bin/make/unit-tests/varname-dot-alltargets.exp |   3 ++
 usr.bin/make/unit-tests/varname-dot-alltargets.mk  |  23 +++++++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r ab3ee5c818ba -r bcccad636c78 usr.bin/make/unit-tests/varname-dot-alltargets.exp
--- a/usr.bin/make/unit-tests/varname-dot-alltargets.exp        Tue Aug 25 22:25:05 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-alltargets.exp        Tue Aug 25 22:51:54 2020 +0000
@@ -1,1 +1,4 @@
+
+first second source
+first second source all .END
 exit status 0
diff -r ab3ee5c818ba -r bcccad636c78 usr.bin/make/unit-tests/varname-dot-alltargets.mk
--- a/usr.bin/make/unit-tests/varname-dot-alltargets.mk Tue Aug 25 22:25:05 2020 +0000
+++ b/usr.bin/make/unit-tests/varname-dot-alltargets.mk Tue Aug 25 22:51:54 2020 +0000
@@ -1,8 +1,25 @@
-# $NetBSD: varname-dot-alltargets.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: varname-dot-alltargets.mk,v 1.3 2020/08/25 22:51:54 rillig Exp $
 #
 # Tests for the special .ALLTARGETS variable.
 
-# TODO: Implementation
+.MAIN: all
+
+TARGETS_1:=    ${.ALLTARGETS}
+
+first second: source
+
+TARGETS_2:=    ${.ALLTARGETS}
 
 all:
-       @:;
+       # Since the tests are run with the -r option, no targets are
+       # defined at the beginning.
+       @echo ${TARGETS_1}
+
+       # Only first and second are "real" targets.
+       # The .ALLTARGETS variable is not about targets though, but
+       # about all nodes, therefore source is also included.
+       @echo ${TARGETS_2}
+
+       # Interestingly, the .END target is also implicitly defined at
+       # this point.
+       @echo ${.ALLTARGETS}



Home | Main Index | Thread Index | Old Index