Module Name:    src
Committed By:   rillig
Date:           Sun Dec 13 00:46:25 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: directive-misspellings.exp
            directive-misspellings.mk

Log Message:
make(1): add test for misspelled directives

This test allows the other directive-* tests to focus on the purpose of
the individual directive, allowing these tests to continue after
parsing, without errors.


To generate a diff of this commit:
cvs rdiff -u -r1.991 -r1.992 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/directive-misspellings.exp \
    src/usr.bin/make/unit-tests/directive-misspellings.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.991 src/distrib/sets/lists/tests/mi:1.992
--- src/distrib/sets/lists/tests/mi:1.991	Sun Dec 13 00:37:43 2020
+++ src/distrib/sets/lists/tests/mi	Sun Dec 13 00:46:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.991 2020/12/13 00:37:43 roy Exp $
+# $NetBSD: mi,v 1.992 2020/12/13 00:46:25 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5072,6 +5072,8 @@
 ./usr/tests/usr.bin/make/unit-tests/directive-include.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-info.exp				tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-info.mk				tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directive-misspellings.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directive-misspellings.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-sinclude.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-sinclude.mk			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/directive-undef.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.245 src/usr.bin/make/unit-tests/Makefile:1.246
--- src/usr.bin/make/unit-tests/Makefile:1.245	Sat Dec 12 15:06:11 2020
+++ src/usr.bin/make/unit-tests/Makefile	Sun Dec 13 00:46:25 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.245 2020/12/12 15:06:11 rillig Exp $
+# $NetBSD: Makefile,v 1.246 2020/12/13 00:46:25 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -164,6 +164,7 @@ TESTS+=		directive-ifnmake
 TESTS+=		directive-include
 TESTS+=		directive-include-fatal
 TESTS+=		directive-info
+TESTS+=		directive-misspellings
 TESTS+=		directive-sinclude
 TESTS+=		directive-undef
 TESTS+=		directive-unexport

Added files:

Index: src/usr.bin/make/unit-tests/directive-misspellings.exp
diff -u /dev/null src/usr.bin/make/unit-tests/directive-misspellings.exp:1.1
--- /dev/null	Sun Dec 13 00:46:25 2020
+++ src/usr.bin/make/unit-tests/directive-misspellings.exp	Sun Dec 13 00:46:25 2020
@@ -0,0 +1,38 @@
+make: "directive-misspellings.mk" line 12: Unknown directive "dinclud"
+make: "directive-misspellings.mk" line 14: Unknown directive "dincludx"
+make: "directive-misspellings.mk" line 15: .include filename must be delimited by '"' or '<'
+make: "directive-misspellings.mk" line 17: Unknown directive "erro"
+make: "directive-misspellings.mk" line 18: Unknown directive "errox"
+make: "directive-misspellings.mk" line 22: Unknown directive "expor"
+make: "directive-misspellings.mk" line 24: Unknown directive "exporx"
+make: "directive-misspellings.mk" line 37: Unknown directive "-includ"
+make: "directive-misspellings.mk" line 39: Unknown directive "-includx"
+make: "directive-misspellings.mk" line 40: .include filename must be delimited by '"' or '<'
+make: "directive-misspellings.mk" line 42: Unknown directive "includ"
+make: "directive-misspellings.mk" line 43: Could not find file
+make: "directive-misspellings.mk" line 44: Unknown directive "includx"
+make: "directive-misspellings.mk" line 45: .include filename must be delimited by '"' or '<'
+make: "directive-misspellings.mk" line 47: Unknown directive "inf"
+make: "directive-misspellings.mk" line 48: msg
+make: "directive-misspellings.mk" line 49: Unknown directive "infx"
+make: "directive-misspellings.mk" line 50: msg
+make: "directive-misspellings.mk" line 52: Unknown directive "sinclud"
+make: "directive-misspellings.mk" line 54: Unknown directive "sincludx"
+make: "directive-misspellings.mk" line 55: .include filename must be delimited by '"' or '<'
+make: "directive-misspellings.mk" line 57: Unknown directive "unde"
+make: "directive-misspellings.mk" line 59: Unknown directive "undex"
+make: "directive-misspellings.mk" line 62: Unknown directive "unexpor"
+make: "directive-misspellings.mk" line 64: Unknown directive "unexporx"
+make: "directive-misspellings.mk" line 65: Unknown directive "unexports varname"
+make: "directive-misspellings.mk" line 67: Unknown directive "unexport-en"
+make: "directive-misspellings.mk" line 69: The directive .unexport-env does not take arguments
+make: "directive-misspellings.mk" line 70: Unknown directive "unexport-enx"
+make: "directive-misspellings.mk" line 71: Unknown directive "unexport-envs"
+make: "directive-misspellings.mk" line 73: Unknown directive "warn"
+make: "directive-misspellings.mk" line 74: Unknown directive "warnin"
+make: "directive-misspellings.mk" line 75: warning: msg
+make: "directive-misspellings.mk" line 76: Unknown directive "warninx"
+make: "directive-misspellings.mk" line 77: warning: msg
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-misspellings.mk
diff -u /dev/null src/usr.bin/make/unit-tests/directive-misspellings.mk:1.1
--- /dev/null	Sun Dec 13 00:46:25 2020
+++ src/usr.bin/make/unit-tests/directive-misspellings.mk	Sun Dec 13 00:46:25 2020
@@ -0,0 +1,79 @@
+# $NetBSD: directive-misspellings.mk,v 1.1 2020/12/13 00:46:25 rillig Exp $
+#
+# Tests for misspelled directives.
+#
+# Before 2020-12-12, make didn't catch most of these misspellings.  For
+# example, the directive ".exporting" was interpreted as if it were spelled
+# ".export ing", which would export the variable named "ing" if that existed.
+# Another misspelling, as improbable as the others, was that both ".infos" and
+# ".information" were aliases to ".info" since the code for these diagnostic
+# directives just skipped any letters following the "error", "warn" or "info".
+
+.dinclud "file"
+.dinclude "file"
+.dincludx "file"
+.dincludes "file"		# XXX: the 's' is not meant to be a filename
+
+.erro msg
+.errox msg
+# no .error since that would exit immediately
+# no .errors since that would exit immediately, even with the typo
+
+.expor varname
+.export varname
+.exporx varname
+.exports varname		# XXX: undetected misspelling
+
+.export-en			# XXX: undetected misspelling
+.export-env
+.export-env extra argument	# XXX: undetected extra argument
+.export-environment		# XXX: undetected misspelling
+
+.export-litera varname		# XXX: undetected misspelling
+.export-literal varname		
+.export-literax varname		# XXX: undetected misspelling
+.export-literally varname	# XXX: undetected misspelling
+
+.-includ "file"
+.-include "file"
+.-includx "file"
+.-includes "file"		# XXX: the 's' is not meant to be a filename
+
+.includ "file"			
+.include "file"
+.includx "file"
+.includex "file"		# XXX: the 's' is not meant to be a filename
+
+.inf msg
+.info msg
+.infx msg
+.infos msg			# XXX: undetected misspelling
+
+.sinclud "file"
+.sinclude "file"
+.sincludx "file"
+.sincludes "file"		# XXX: the 's' is not meant to be a filename
+
+.unde varname
+.undef varname
+.undex varname
+.undefs varname			# XXX: undetected misspelling
+
+.unexpor varname
+.unexport varname
+.unexporx varname
+.unexports varname		# Accepted before 2020-12-12 18:00:18.
+
+.unexport-en			# Accepted before 2020-12-12 18:11:42.
+.unexport-env
+.unexport-env extra argument	# Accepted before 2020-12-12 18:00:18.
+.unexport-enx			# Accepted before 2020-12-12 18:00:18.
+.unexport-envs			# Accepted before 2020-12-12 18:00:18.
+
+.warn msg
+.warnin msg
+.warning msg
+.warninx msg
+.warnings msg			# XXX: undetected misspelling
+
+all:

Reply via email to