Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add test for parse errors i...



details:   https://anonhg.NetBSD.org/src/rev/438564efa62d
branches:  trunk
changeset: 941980:438564efa62d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 02 20:20:42 2020 +0000

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

diffstat:

 distrib/sets/lists/tests/mi            |   4 +++-
 usr.bin/make/unit-tests/Makefile       |   3 ++-
 usr.bin/make/unit-tests/cmd-errors.exp |   6 ++++++
 usr.bin/make/unit-tests/cmd-errors.mk  |  24 ++++++++++++++++++++++++
 4 files changed, 35 insertions(+), 2 deletions(-)

diffs (73 lines):

diff -r 7b1c1a2f3e76 -r 438564efa62d distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Mon Nov 02 20:19:33 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Mon Nov 02 20:20:42 2020 +0000
@@ -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
diff -r 7b1c1a2f3e76 -r 438564efa62d usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Mon Nov 02 20:19:33 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Mon Nov 02 20:20:42 2020 +0000
@@ -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
diff -r 7b1c1a2f3e76 -r 438564efa62d usr.bin/make/unit-tests/cmd-errors.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.exp    Mon Nov 02 20:20:42 2020 +0000
@@ -0,0 +1,6 @@
+: undefined 
+: unclosed 
+make: Unknown modifier 'Z'
+: unknown-modifier 
+: end
+exit status 0
diff -r 7b1c1a2f3e76 -r 438564efa62d usr.bin/make/unit-tests/cmd-errors.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.mk     Mon Nov 02 20:20:42 2020 +0000
@@ -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:
+       : $@



Home | Main Index | Thread Index | Old Index