make(1): add test for unintended "recursive variable" in -dL mode

This commit is contained in:
rillig 2020-08-06 05:36:32 +00:00
parent 237062f441
commit 4d4fd97a93
4 changed files with 33 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.884 2020/08/03 15:43:31 rillig Exp $
# $NetBSD: mi,v 1.885 2020/08/06 05:36:32 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -4598,6 +4598,8 @@
./usr/tests/usr.bin/make/unit-tests/posix1.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/qequals.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/qequals.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/recursive.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/recursive.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suffixes.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/suffixes.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/sunshcmd.exp tests-usr.bin-tests compattestfile,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.83 2020/08/03 15:43:32 rillig Exp $
# $NetBSD: Makefile,v 1.84 2020/08/06 05:36:33 rillig Exp $
#
# Unit tests for make(1)
#
@ -70,6 +70,7 @@ TESTS+= # phony-end # broken by reverting POSIX changes
TESTS+= posix
TESTS+= # posix1 # broken by reverting POSIX changes
TESTS+= qequals
TESTS+= recursive
TESTS+= # suffixes # broken by reverting POSIX changes
TESTS+= sunshcmd
TESTS+= sysv
@ -90,6 +91,7 @@ ENV.counter= -i
ENV.envfirst= FROM_ENV=value-from-env
ENV.export= -i PATH=${PATH:Q}
ENV.lint= -i
ENV.recursive= -i
ENV.varmisc= FROM_ENV=env
ENV.varmisc+= FROM_ENV_BEFORE=env
ENV.varmisc+= FROM_ENV_AFTER=env
@ -101,6 +103,7 @@ FLAGS.envfirst= -e
FLAGS.export= -r
FLAGS.lint= -dL -k
FLAGS.order= -j1
FLAGS.recursive= -dL
FLAGS.vardebug= -k -dv FROM_CMDLINE=
# Some tests need extra post-processing.

View File

@ -0,0 +1,4 @@
Variable am__v_lt_ is recursive.
make: stopped in unit-tests
exit status 2

View File

@ -0,0 +1,22 @@
# $NetBSD: recursive.mk,v 1.1 2020/08/06 05:36:33 rillig Exp $
#
# In -dL mode, a variable may get expanded before it makes sense.
# This would stop make from doing anything since the "recursive" error
# is fatal and exits immediately.
#
# The purpose of evaluating that variable early was just to detect
# whether there are unclosed variables. It might be enough to parse the
# variable value without VARE_WANTRES for that purpose.
#
# Seen in pkgsrc/x11/libXfixes, and probably many more package that use
# GNU Automake.
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
am__v_lt_1 =
libXfixes_la_LINK = ... $(AM_V_lt) ...
.info not reached
# somewhere later ...
AM_DEFAULT_VERBOSITY = 1