make(1): add test for combining :: and .USEBEFORE

This commit is contained in:
rillig 2020-08-22 08:29:13 +00:00
parent 167898024d
commit 49fef3ca66
4 changed files with 38 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.896 2020/08/20 21:28:01 riastradh Exp $
# $NetBSD: mi,v 1.897 2020/08/22 08:29:13 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -4627,6 +4627,8 @@
./usr/tests/usr.bin/make/unit-tests/depsrc-silent.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-use.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-use.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-usebefore-double-colon.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-usebefore-double-colon.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-usebefore.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-usebefore.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/depsrc-wait.exp tests-usr.bin-tests compattestfile,atf
@ -4771,8 +4773,6 @@
./usr/tests/usr.bin/make/unit-tests/modmatch.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modmisc.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modmisc.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modorder.exp tests-obsolete obsolete
./usr/tests/usr.bin/make/unit-tests/modorder.mk tests-obsolete obsolete
./usr/tests/usr.bin/make/unit-tests/modts.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modts.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/modword.exp tests-usr.bin-tests compattestfile,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.104 2020/08/20 18:05:57 rillig Exp $
# $NetBSD: Makefile,v 1.105 2020/08/22 08:29:13 rillig Exp $
#
# Unit tests for make(1)
#
@ -83,6 +83,7 @@ TESTS+= depsrc-recursive
TESTS+= depsrc-silent
TESTS+= depsrc-use
TESTS+= depsrc-usebefore
TESTS+= depsrc-usebefore-double-colon
TESTS+= depsrc-wait
TESTS+= deptgt
TESTS+= deptgt-begin
@ -436,6 +437,7 @@ sync-mi:
@set -eu; \
cd "${MAKEFILE:tA:H}/../../.."; \
mi="distrib/sets/lists/tests/mi"; \
cvs update "$$mi"; \
awk ${SYNC_MI_AWK:Q} < "$$mi" > "$$mi.$@"; \
mv -f "$$mi.$@" "$$mi"; \
cvs diff "$$mi" || true

View File

@ -0,0 +1,2 @@
double-colon early 1
exit status 0

View File

@ -0,0 +1,30 @@
# $NetBSD: depsrc-usebefore-double-colon.mk,v 1.1 2020/08/22 08:29:13 rillig Exp $
#
# Tests for the special source .USEBEFORE in dependency declarations,
# combined with the double-colon dependency operator.
all: action
# The dependency operator :: allows commands to be added later to the same
# target.
double-colon:: .USEBEFORE
@echo double-colon early 1
# This command is ignored, which kind of makes sense since this dependency
# declaration has no .USEBEFORE source.
double-colon::
@echo double-colon early 2
# XXX: This command is ignored even though it has a .USEBEFORE source.
# This is unexpected.
double-colon:: .USEBEFORE
@echo double-colon early 3
# At this point, the commands from the .USEBEFORE targets are copied to
# the "action" target.
action: double-colon
# This command is not added to the "action" target since it comes too late.
# The commands had been copied in the previous line already.
double-colon::
@echo double-colon late