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 expansion erro...



details:   https://anonhg.NetBSD.org/src/rev/f8f77ef93c06
branches:  trunk
changeset: 948326:f8f77ef93c06
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 27 05:11:40 2020 +0000

description:
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.

diffstat:

 distrib/sets/lists/tests/mi                 |   4 ++-
 usr.bin/make/unit-tests/Makefile            |   3 +-
 usr.bin/make/unit-tests/cmd-errors-jobs.exp |   9 ++++++++
 usr.bin/make/unit-tests/cmd-errors-jobs.mk  |  32 +++++++++++++++++++++++++++++
 usr.bin/make/unit-tests/cmd-errors.mk       |   4 +-
 5 files changed, 48 insertions(+), 4 deletions(-)

diffs (97 lines):

diff -r 3b9359e0ecfb -r f8f77ef93c06 distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Dec 27 05:06:17 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Dec 27 05:11:40 2020 +0000
@@ -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
diff -r 3b9359e0ecfb -r f8f77ef93c06 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Dec 27 05:06:17 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Dec 27 05:11:40 2020 +0000
@@ -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
diff -r 3b9359e0ecfb -r f8f77ef93c06 usr.bin/make/unit-tests/cmd-errors-jobs.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors-jobs.exp       Sun Dec 27 05:11:40 2020 +0000
@@ -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
diff -r 3b9359e0ecfb -r f8f77ef93c06 usr.bin/make/unit-tests/cmd-errors-jobs.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors-jobs.mk        Sun Dec 27 05:11:40 2020 +0000
@@ -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.
diff -r 3b9359e0ecfb -r f8f77ef93c06 usr.bin/make/unit-tests/cmd-errors.mk
--- a/usr.bin/make/unit-tests/cmd-errors.mk     Sun Dec 27 05:06:17 2020 +0000
+++ b/usr.bin/make/unit-tests/cmd-errors.mk     Sun Dec 27 05:11:40 2020 +0000
@@ -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
 



Home | Main Index | Thread Index | Old Index