Module Name: src Committed By: rillig Date: Mon Nov 2 20:20:43 UTC 2020
Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: cmd-errors.exp cmd-errors.mk Log Message: make(1): add test for parse errors in shell commands, compat mode To generate a diff of this commit: cvs rdiff -u -r1.957 -r1.958 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.182 -r1.183 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cmd-errors.exp \ src/usr.bin/make/unit-tests/cmd-errors.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.957 src/distrib/sets/lists/tests/mi:1.958 --- src/distrib/sets/lists/tests/mi:1.957 Mon Nov 2 20:16:26 2020 +++ src/distrib/sets/lists/tests/mi Mon Nov 2 20:20:42 2020 @@ -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 Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.182 src/usr.bin/make/unit-tests/Makefile:1.183 --- src/usr.bin/make/unit-tests/Makefile:1.182 Mon Nov 2 20:19:33 2020 +++ src/usr.bin/make/unit-tests/Makefile Mon Nov 2 20:20:42 2020 @@ -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 Added files: Index: src/usr.bin/make/unit-tests/cmd-errors.exp diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors.exp:1.1 --- /dev/null Mon Nov 2 20:20:43 2020 +++ src/usr.bin/make/unit-tests/cmd-errors.exp Mon Nov 2 20:20:42 2020 @@ -0,0 +1,6 @@ +: undefined +: unclosed +make: Unknown modifier 'Z' +: unknown-modifier +: end +exit status 0 Index: src/usr.bin/make/unit-tests/cmd-errors.mk diff -u /dev/null src/usr.bin/make/unit-tests/cmd-errors.mk:1.1 --- /dev/null Mon Nov 2 20:20:43 2020 +++ src/usr.bin/make/unit-tests/cmd-errors.mk Mon Nov 2 20:20:42 2020 @@ -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: + : $@