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 tests/make: test MAKEFLAGS in POSIX ...



details:   https://anonhg.NetBSD.org/src/rev/0464fa6f82b8
branches:  trunk
changeset: 1029211:0464fa6f82b8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Dec 27 20:17:35 2021 +0000

description:
tests/make: test MAKEFLAGS in POSIX mode

This test covers the function 'explode' in main.c, the case in which the
flags are actually expanded.

diffstat:

 usr.bin/make/unit-tests/varname-makeflags.mk |  20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r 89ca03a61bc0 -r 0464fa6f82b8 usr.bin/make/unit-tests/varname-makeflags.mk
--- a/usr.bin/make/unit-tests/varname-makeflags.mk      Mon Dec 27 19:06:07 2021 +0000
+++ b/usr.bin/make/unit-tests/varname-makeflags.mk      Mon Dec 27 20:17:35 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: varname-makeflags.mk,v 1.3 2020/12/01 20:37:30 rillig Exp $
+# $NetBSD: varname-makeflags.mk,v 1.4 2021/12/27 20:17:35 rillig Exp $
 #
 # Tests for the special MAKEFLAGS variable, which is basically just a normal
 # environment variable.  It is closely related to .MAKEFLAGS but captures the
@@ -23,4 +23,22 @@
 .  error
 .endif
 
+
+# In POSIX mode, the environment variable MAKEFLAGS can contain letters only,
+# for compatibility.  These letters are exploded to form regular options.
+OUTPUT!=       env MAKEFLAGS=ikrs ${MAKE} -f /dev/null -v .MAKEFLAGS
+.if ${OUTPUT} != " -i -k -r -s -V .MAKEFLAGS"
+.  error
+.endif
+
+# As soon as there is a single non-alphabetic character in the environment
+# variable MAKEFLAGS, it is no longer split.  In this example, the word
+# "d0ikrs" is treated as a target, but the option '-v' prevents any targets
+# from being built.
+OUTPUT!=       env MAKEFLAGS=d0ikrs ${MAKE} -f /dev/null -v .MAKEFLAGS
+.if ${OUTPUT} != " -V .MAKEFLAGS"
+.  error ${OUTPUT}
+.endif
+
+
 all:



Home | Main Index | Thread Index | Old Index