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 make() functio...



details:   https://anonhg.NetBSD.org/src/rev/cb1d2115e3a3
branches:  trunk
changeset: 955274:cb1d2115e3a3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 25 20:11:06 2020 +0000

description:
make(1): add test for make() function in conditions

diffstat:

 usr.bin/make/unit-tests/Makefile           |   3 ++-
 usr.bin/make/unit-tests/cond-func-make.exp |   2 ++
 usr.bin/make/unit-tests/cond-func-make.mk  |  26 +++++++++++++++++++++-----
 3 files changed, 25 insertions(+), 6 deletions(-)

diffs (57 lines):

diff -r a825b78ecf7b -r cb1d2115e3a3 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Fri Sep 25 19:50:04 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Fri Sep 25 20:11:06 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.150 2020/09/25 18:18:25 rillig Exp $
+# $NetBSD: Makefile,v 1.151 2020/09/25 20:11:06 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -362,6 +362,7 @@
 # Override make flags for some of the tests; default is -k.
 # If possible, write ".MAKEFLAGS: -dv" in the test .mk file instead of
 # settings FLAGS.test=-dv here, since that is closer to the test code.
+FLAGS.cond-func-make=  via-cmdline
 FLAGS.directive-ifmake=        first second
 FLAGS.doterror=                # none
 FLAGS.envfirst=                -e
diff -r a825b78ecf7b -r cb1d2115e3a3 usr.bin/make/unit-tests/cond-func-make.exp
--- a/usr.bin/make/unit-tests/cond-func-make.exp        Fri Sep 25 19:50:04 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-make.exp        Fri Sep 25 20:11:06 2020 +0000
@@ -1,1 +1,3 @@
+: via-cmdline
+: via-dot-makeflags
 exit status 0
diff -r a825b78ecf7b -r cb1d2115e3a3 usr.bin/make/unit-tests/cond-func-make.mk
--- a/usr.bin/make/unit-tests/cond-func-make.mk Fri Sep 25 19:50:04 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-make.mk Fri Sep 25 20:11:06 2020 +0000
@@ -1,8 +1,24 @@
-# $NetBSD: cond-func-make.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: cond-func-make.mk,v 1.3 2020/09/25 20:11:06 rillig Exp $
 #
-# Tests for the make() function in .if conditions.
+# Tests for the make() function in .if conditions, which tests whether
+# the argument has been passed as a target via the command line or later
+# via the .MAKEFLAGS special dependency target.
 
-# TODO: Implementation
+.if !make(via-cmdline)
+.  error
+.endif
+.if make(via-dot-makeflags)
+.  error
+.endif
+
+.MAKEFLAGS: via-dot-makeflags
 
-all:
-       @:;
+.if !make(via-cmdline)
+.  error
+.endif
+.if !make(via-dot-makeflags)
+.  error
+.endif
+
+via-cmdline via-dot-makeflags:
+       : $@



Home | Main Index | Thread Index | Old Index