make(1): add test for expansion errors in jobs mode

Since compat mode and jobs mode are implemented separately and vary in
lots of small details, each of them needs to be tested on its own.
This commit is contained in:
rillig 2020-12-27 05:11:40 +00:00
parent ea8c5a40a4
commit 0134a24c0d
5 changed files with 48 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.996 2020/12/19 16:00:17 rillig Exp $
# $NetBSD: mi,v 1.997 2020/12/27 05:11:40 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -4818,6 +4818,8 @@
./usr/tests/usr.bin/make/unit-tests/archive-suffix.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/archive.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/archive.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors-jobs.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors-jobs.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors-lint.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors.exp tests-usr.bin-tests compattestfile,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.256 2020/12/21 20:47:29 rillig Exp $
# $NetBSD: Makefile,v 1.257 2020/12/27 05:11:40 rillig Exp $
#
# Unit tests for make(1)
#
@ -42,6 +42,7 @@
TESTS+= archive
TESTS+= archive-suffix
TESTS+= cmd-errors
TESTS+= cmd-errors-jobs
TESTS+= cmd-errors-lint
TESTS+= cmd-interrupt
TESTS+= cmdline

View File

@ -0,0 +1,9 @@
: undefined eol
make: Unclosed variable "UNCLOSED"
: unclosed-variable
make: Unclosed variable expression (expecting '}') for "UNCLOSED"
: unclosed-modifier
make: Unknown modifier 'Z'
: unknown-modifier eol
: end eol
exit status 0

View File

@ -0,0 +1,32 @@
# $NetBSD: cmd-errors-jobs.mk,v 1.1 2020/12/27 05:11:40 rillig Exp $
#
# Demonstrate how errors in variable expansions affect whether the commands
# are actually executed in jobs mode.
.MAKEFLAGS: -j1
all: undefined unclosed-variable unclosed-modifier unknown-modifier end
# Undefined variables are not an error. They expand to empty strings.
undefined:
: $@ ${UNDEFINED} eol
# XXX: As of 2020-11-01, this command is executed even though it contains
# parse errors.
unclosed-variable:
: $@ ${UNCLOSED
# XXX: As of 2020-11-01, this command is executed even though it contains
# parse errors.
unclosed-modifier:
: $@ ${UNCLOSED:
# XXX: As of 2020-11-01, this command is executed even though it contains
# parse errors.
unknown-modifier:
: $@ ${UNKNOWN:Z} eol
end:
: $@ eol
# XXX: As of 2020-11-02, despite the parse errors, the exit status is 0.

View File

@ -1,7 +1,7 @@
# $NetBSD: cmd-errors.mk,v 1.3 2020/11/09 23:36:34 rillig Exp $
# $NetBSD: cmd-errors.mk,v 1.4 2020/12/27 05:11:40 rillig Exp $
#
# Demonstrate how errors in variable expansions affect whether the commands
# are actually executed.
# are actually executed in compat mode.
all: undefined unclosed-variable unclosed-modifier unknown-modifier end