make(1): add test for parse errors in shell commands, compat mode

This commit is contained in:
rillig 2020-11-02 20:20:42 +00:00
parent a758ae2cb7
commit 1d4c05cdbb
4 changed files with 35 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.957 2020/11/02 20:16:26 rillig Exp $
# $NetBSD: mi,v 1.958 2020/11/02 20:20:42 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -4813,6 +4813,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.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-errors.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmd-interrupt.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/cmdline.exp tests-usr.bin-tests compattestfile,atf

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.182 2020/11/02 20:19:33 rillig Exp $
# $NetBSD: Makefile,v 1.183 2020/11/02 20:20:42 rillig Exp $
#
# Unit tests for make(1)
#
@ -37,6 +37,7 @@
# src/tests/usr.bin/make/t_make.sh as well.
TESTS+= archive
TESTS+= archive-suffix
TESTS+= cmd-errors
TESTS+= cmd-interrupt
TESTS+= cmdline
TESTS+= comment

View File

@ -0,0 +1,6 @@
: undefined
: unclosed
make: Unknown modifier 'Z'
: unknown-modifier
: end
exit status 0

View File

@ -0,0 +1,24 @@
# $NetBSD: cmd-errors.mk,v 1.1 2020/11/02 20:20:42 rillig Exp $
#
# Demonstrate how errors in variable expansions affect whether the commands
# are actually executed.
all: undefined unclosed unknown-modifier end
# Undefined variables are not an error. They expand to empty strings.
undefined:
: $@ ${UNDEFINED}
# XXX: As of 2020-11-01, this obvious syntax error is not detected.
# XXX: As of 2020-11-01, this command is executed even though it contains
# parse errors.
unclosed:
: $@ ${UNCLOSED:
# XXX: As of 2020-11-01, this command is executed even though it contains
# parse errors.
unknown-modifier:
: $@ ${UNKNOWN:Z}
end:
: $@