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 misspelled dir...



details:   https://anonhg.NetBSD.org/src/rev/419afdf7757d
branches:  trunk
changeset: 979076:419afdf7757d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Dec 13 00:46:25 2020 +0000

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

diffstat:

 distrib/sets/lists/tests/mi                        |   4 +-
 usr.bin/make/unit-tests/Makefile                   |   3 +-
 usr.bin/make/unit-tests/directive-misspellings.exp |  38 ++++++++++
 usr.bin/make/unit-tests/directive-misspellings.mk  |  79 ++++++++++++++++++++++
 4 files changed, 122 insertions(+), 2 deletions(-)

diffs (160 lines):

diff -r 653dc309ddd0 -r 419afdf7757d distrib/sets/lists/tests/mi
--- a/distrib/sets/lists/tests/mi       Sun Dec 13 00:37:43 2020 +0000
+++ b/distrib/sets/lists/tests/mi       Sun Dec 13 00:46:25 2020 +0000
@@ -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
diff -r 653dc309ddd0 -r 419afdf7757d usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Dec 13 00:37:43 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Dec 13 00:46:25 2020 +0000
@@ -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-include
 TESTS+=                directive-include-fatal
 TESTS+=                directive-info
+TESTS+=                directive-misspellings
 TESTS+=                directive-sinclude
 TESTS+=                directive-undef
 TESTS+=                directive-unexport
diff -r 653dc309ddd0 -r 419afdf7757d usr.bin/make/unit-tests/directive-misspellings.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-misspellings.exp        Sun Dec 13 00:46:25 2020 +0000
@@ -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
diff -r 653dc309ddd0 -r 419afdf7757d usr.bin/make/unit-tests/directive-misspellings.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-misspellings.mk Sun Dec 13 00:46:25 2020 +0000
@@ -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:



Home | Main Index | Thread Index | Old Index