Module Name: src
Committed By: rillig
Date: Tue Nov 3 17:17:31 UTC 2020
Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile directive-elif.exp
directive-elif.mk directive-export-env.mk
directive-export-literal.mk directive-export.exp
directive-export.mk directive-include.exp directive-include.mk
directive-info.exp directive-info.mk directive-undef.exp
directive-undef.mk directive-unexport-env.mk directive-unexport.exp
directive-unexport.mk directive-warning.exp directive-warning.mk
directive.exp directive.mk
Removed Files:
src/usr.bin/make/unit-tests: directives.exp directives.mk
Log Message:
make(1): move tests from directives.mk to separate tests
To generate a diff of this commit:
cvs rdiff -u -r1.959 -r1.960 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.186 -r1.187 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-elif.exp \
src/usr.bin/make/unit-tests/directive-export.exp \
src/usr.bin/make/unit-tests/directive-info.exp \
src/usr.bin/make/unit-tests/directive-undef.exp \
src/usr.bin/make/unit-tests/directive-warning.exp \
src/usr.bin/make/unit-tests/directive.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-elif.mk \
src/usr.bin/make/unit-tests/directive-export-env.mk \
src/usr.bin/make/unit-tests/directive-info.mk \
src/usr.bin/make/unit-tests/directive-unexport-env.mk \
src/usr.bin/make/unit-tests/directive-warning.mk \
src/usr.bin/make/unit-tests/directive.mk
cvs rdiff -u -r1.5 -r1.6 \
src/usr.bin/make/unit-tests/directive-export-literal.mk
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-export.mk \
src/usr.bin/make/unit-tests/directive-include.exp \
src/usr.bin/make/unit-tests/directive-include.mk \
src/usr.bin/make/unit-tests/directive-unexport.exp
cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-undef.mk \
src/usr.bin/make/unit-tests/directive-unexport.mk
cvs rdiff -u -r1.5 -r0 src/usr.bin/make/unit-tests/directives.exp
cvs rdiff -u -r1.6 -r0 src/usr.bin/make/unit-tests/directives.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.959 src/distrib/sets/lists/tests/mi:1.960
--- src/distrib/sets/lists/tests/mi:1.959 Mon Nov 2 20:43:27 2020
+++ src/distrib/sets/lists/tests/mi Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.959 2020/11/02 20:43:27 rillig Exp $
+# $NetBSD: mi,v 1.960 2020/11/03 17:17:31 rillig Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -5059,8 +5059,8 @@
./usr/tests/usr.bin/make/unit-tests/directive-warning.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/directive.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/directive.mk tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/directives.exp tests-usr.bin-tests compattestfile,atf
-./usr/tests/usr.bin/make/unit-tests/directives.mk tests-usr.bin-tests compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/directives.exp tests-obsolete obsolete
+./usr/tests/usr.bin/make/unit-tests/directives.mk tests-obsolete obsolete
./usr/tests/usr.bin/make/unit-tests/dollar.exp tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/dollar.mk tests-usr.bin-tests compattestfile,atf
./usr/tests/usr.bin/make/unit-tests/doterror.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.186 src/usr.bin/make/unit-tests/Makefile:1.187
--- src/usr.bin/make/unit-tests/Makefile:1.186 Mon Nov 2 21:53:28 2020
+++ src/usr.bin/make/unit-tests/Makefile Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.186 2020/11/02 21:53:28 rillig Exp $
+# $NetBSD: Makefile,v 1.187 2020/11/03 17:17:31 rillig Exp $
#
# Unit tests for make(1)
#
@@ -159,7 +159,6 @@ TESTS+= directive-undef
TESTS+= directive-unexport
TESTS+= directive-unexport-env
TESTS+= directive-warning
-TESTS+= directives
TESTS+= dollar
TESTS+= doterror
TESTS+= dotwait
Index: src/usr.bin/make/unit-tests/directive-elif.exp
diff -u src/usr.bin/make/unit-tests/directive-elif.exp:1.1 src/usr.bin/make/unit-tests/directive-elif.exp:1.2
--- src/usr.bin/make/unit-tests/directive-elif.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-elif.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,15 @@
-exit status 0
+make: "directive-elif.mk" line 7: begin .elif misspellings tests, part 1
+make: "directive-elif.mk" line 9: 1-then
+make: "directive-elif.mk" line 18: begin .elif misspellings tests, part 2
+make: "directive-elif.mk" line 29: begin .elif misspellings tests, part 3
+make: "directive-elif.mk" line 41: which branch is taken on misspelling after false?
+make: "directive-elif.mk" line 49: else
+make: "directive-elif.mk" line 52: which branch is taken on misspelling after true?
+make: "directive-elif.mk" line 54: 1-then
+make: "directive-elif.mk" line 55: Unknown directive "elsif"
+make: "directive-elif.mk" line 56: 1-elsif
+make: "directive-elif.mk" line 57: Unknown directive "elsif"
+make: "directive-elif.mk" line 58: 2-elsif
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-export.exp
diff -u src/usr.bin/make/unit-tests/directive-export.exp:1.1 src/usr.bin/make/unit-tests/directive-export.exp:1.2
--- src/usr.bin/make/unit-tests/directive-export.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-export.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,4 @@
-exit status 0
+make: "directive-export.mk" line 25: Unknown directive "expor"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-info.exp
diff -u src/usr.bin/make/unit-tests/directive-info.exp:1.1 src/usr.bin/make/unit-tests/directive-info.exp:1.2
--- src/usr.bin/make/unit-tests/directive-info.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-info.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,10 @@
-exit status 0
+make: "directive-info.mk" line 7: begin .info tests
+make: "directive-info.mk" line 8: Unknown directive "inf"
+make: "directive-info.mk" line 9: Unknown directive "info"
+make: "directive-info.mk" line 10: message
+make: "directive-info.mk" line 11: indented message
+make: "directive-info.mk" line 12: Unknown directive "information"
+make: "directive-info.mk" line 13: message
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-undef.exp
diff -u src/usr.bin/make/unit-tests/directive-undef.exp:1.1 src/usr.bin/make/unit-tests/directive-undef.exp:1.2
--- src/usr.bin/make/unit-tests/directive-undef.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-undef.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,4 @@
-exit status 0
+make: "directive-undef.mk" line 16: Unknown directive "unde"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-warning.exp
diff -u src/usr.bin/make/unit-tests/directive-warning.exp:1.1 src/usr.bin/make/unit-tests/directive-warning.exp:1.2
--- src/usr.bin/make/unit-tests/directive-warning.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive-warning.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,11 @@
-exit status 0
+make: "directive-warning.mk" line 7: Unknown directive "warn"
+make: "directive-warning.mk" line 8: Unknown directive "warn"
+make: "directive-warning.mk" line 9: Unknown directive "warnin"
+make: "directive-warning.mk" line 10: Unknown directive "warnin"
+make: "directive-warning.mk" line 11: Unknown directive "warning"
+make: "directive-warning.mk" line 12: warning: message
+make: "directive-warning.mk" line 13: Unknown directive "warnings"
+make: "directive-warning.mk" line 14: warning: messages
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive.exp
diff -u src/usr.bin/make/unit-tests/directive.exp:1.1 src/usr.bin/make/unit-tests/directive.exp:1.2
--- src/usr.bin/make/unit-tests/directive.exp:1.1 Sun Aug 16 12:07:51 2020
+++ src/usr.bin/make/unit-tests/directive.exp Tue Nov 3 17:17:31 2020
@@ -1 +1,7 @@
-exit status 0
+make: "directive.mk" line 9: Unknown directive "indented"
+make: "directive.mk" line 10: Unknown directive "indented"
+make: "directive.mk" line 11: Unknown directive "indented"
+make: "directive.mk" line 15: Unknown directive "info"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-elif.mk
diff -u src/usr.bin/make/unit-tests/directive-elif.mk:1.2 src/usr.bin/make/unit-tests/directive-elif.mk:1.3
--- src/usr.bin/make/unit-tests/directive-elif.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-elif.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,64 @@
-# $NetBSD: directive-elif.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-elif.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .elif directive.
# TODO: Implementation
+.info begin .elif misspellings tests, part 1
+.if 1
+. info 1-then
+.elif 1 # ok
+. info 1-elif
+.elsif 1 # oops: misspelled
+. info 1-elsif
+.elseif 1 # oops: misspelled
+. info 1-elseif
+.endif
+
+.info begin .elif misspellings tests, part 2
+.if 0
+. info 0-then
+.elif 0 # ok
+. info 0-elif
+.elsif 0 # oops: misspelled
+. info 0-elsif
+.elseif 0 # oops: misspelled
+. info 0-elseif
+.endif
+
+.info begin .elif misspellings tests, part 3
+.if 0
+. info 0-then
+.elsif 0 # oops: misspelled
+. info 0-elsif
+.endif
+.if 0
+. info 0-then
+.elseif 0 # oops: misspelled
+. info 0-elseif
+.endif
+
+.info which branch is taken on misspelling after false?
+.if 0
+. info 0-then
+.elsif 1
+. info 1-elsif
+.elsif 2
+. info 2-elsif
+.else
+. info else
+.endif
+
+.info which branch is taken on misspelling after true?
+.if 1
+. info 1-then
+.elsif 1
+. info 1-elsif
+.elsif 2
+. info 2-elsif
+.else
+. info else
+.endif
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-export-env.mk
diff -u src/usr.bin/make/unit-tests/directive-export-env.mk:1.2 src/usr.bin/make/unit-tests/directive-export-env.mk:1.3
--- src/usr.bin/make/unit-tests/directive-export-env.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-export-env.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,12 @@
-# $NetBSD: directive-export-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-export-env.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .export-env directive.
# TODO: Implementation
+.export-en # oops: misspelled
+.export-env
+.export-environment # oops: misspelled
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-info.mk
diff -u src/usr.bin/make/unit-tests/directive-info.mk:1.2 src/usr.bin/make/unit-tests/directive-info.mk:1.3
--- src/usr.bin/make/unit-tests/directive-info.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-info.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,17 @@
-# $NetBSD: directive-info.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-info.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .info directive.
# TODO: Implementation
+.info begin .info tests
+.inf # misspelled
+.info # oops: message should be "missing parameter"
+.info message
+.info indented message
+.information
+.information message # oops: misspelled
+.info.man: # not a message, but possibly a suffix rule
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-unexport-env.mk
diff -u src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.2 src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.3
--- src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-unexport-env.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,12 @@
-# $NetBSD: directive-unexport-env.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-unexport-env.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .unexport-env directive.
# TODO: Implementation
+.unexport-en # oops: misspelled
+.unexport-env # ok
+.unexport-environment # oops: misspelled
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-warning.mk
diff -u src/usr.bin/make/unit-tests/directive-warning.mk:1.2 src/usr.bin/make/unit-tests/directive-warning.mk:1.3
--- src/usr.bin/make/unit-tests/directive-warning.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive-warning.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,17 @@
-# $NetBSD: directive-warning.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive-warning.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .warning directive.
# TODO: Implementation
+.warn # misspelled
+.warn message # misspelled
+.warnin # misspelled
+.warnin message # misspelled
+.warning # oops: should be "missing argument"
+.warning message # ok
+.warnings # misspelled
+.warnings messages # oops
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive.mk
diff -u src/usr.bin/make/unit-tests/directive.mk:1.2 src/usr.bin/make/unit-tests/directive.mk:1.3
--- src/usr.bin/make/unit-tests/directive.mk:1.2 Sun Aug 16 14:25:16 2020
+++ src/usr.bin/make/unit-tests/directive.mk Tue Nov 3 17:17:31 2020
@@ -1,8 +1,18 @@
-# $NetBSD: directive.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: directive.mk,v 1.3 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the preprocessing directives, such as .if or .info.
# TODO: Implementation
+# Unknown directives are correctly named in the error messages,
+# even if they are indented.
+.indented none
+. indented 2 spaces
+. indented tab
+
+# Directives must be written directly, not indirectly via variable
+# expressions.
+.${:Uinfo} directives cannot be indirect
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-export-literal.mk
diff -u src/usr.bin/make/unit-tests/directive-export-literal.mk:1.5 src/usr.bin/make/unit-tests/directive-export-literal.mk:1.6
--- src/usr.bin/make/unit-tests/directive-export-literal.mk:1.5 Mon Oct 5 19:27:48 2020
+++ src/usr.bin/make/unit-tests/directive-export-literal.mk Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export-literal.mk,v 1.5 2020/10/05 19:27:48 rillig Exp $
+# $NetBSD: directive-export-literal.mk,v 1.6 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .export-literal directive, which exports a variable value
# without expanding it.
@@ -7,5 +7,9 @@ UT_VAR= value with ${UNEXPANDED} expres
.export-literal UT_VAR
+.export-litera # oops: misspelled
+.export-literal # oops: missing argument
+.export-literally # oops: misspelled
+
all:
@echo "$$UT_VAR"
Index: src/usr.bin/make/unit-tests/directive-export.mk
diff -u src/usr.bin/make/unit-tests/directive-export.mk:1.3 src/usr.bin/make/unit-tests/directive-export.mk:1.4
--- src/usr.bin/make/unit-tests/directive-export.mk:1.3 Thu Oct 29 17:27:12 2020
+++ src/usr.bin/make/unit-tests/directive-export.mk Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-export.mk,v 1.3 2020/10/29 17:27:12 rillig Exp $
+# $NetBSD: directive-export.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .export directive.
@@ -21,5 +21,11 @@ VAR= value $$ ${INDIRECT}
. error
.endif
+# Tests for parsing the .export directive.
+.expor # misspelled
+.export # oops: missing argument
+.export VARNAME
+.exporting works # oops: misspelled
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-include.exp
diff -u src/usr.bin/make/unit-tests/directive-include.exp:1.3 src/usr.bin/make/unit-tests/directive-include.exp:1.4
--- src/usr.bin/make/unit-tests/directive-include.exp:1.3 Sat Oct 31 23:01:23 2020
+++ src/usr.bin/make/unit-tests/directive-include.exp Tue Nov 3 17:17:31 2020
@@ -2,4 +2,7 @@ CondParser_Eval: ${.MAKE.MAKEFILES:T} !=
lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
CondParser_Eval: ${.MAKE.MAKEFILES:T} != "${.PARSEFILE} null"
lhs = "directive-include.mk null", rhs = "directive-include.mk null", op = !=
-exit status 0
+make: "directive-include.mk" line 25: Could not find nonexistent.mk
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-include.mk
diff -u src/usr.bin/make/unit-tests/directive-include.mk:1.3 src/usr.bin/make/unit-tests/directive-include.mk:1.4
--- src/usr.bin/make/unit-tests/directive-include.mk:1.3 Sat Oct 31 23:01:23 2020
+++ src/usr.bin/make/unit-tests/directive-include.mk Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-include.mk,v 1.3 2020/10/31 23:01:23 rillig Exp $
+# $NetBSD: directive-include.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .include directive, which includes another file.
@@ -22,5 +22,10 @@
. error
.endif
+.include "nonexistent.mk"
+.include "/dev/null" # size 0
+# including a directory technically succeeds, but shouldn't.
+#.include "." # directory
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-unexport.exp
diff -u src/usr.bin/make/unit-tests/directive-unexport.exp:1.3 src/usr.bin/make/unit-tests/directive-unexport.exp:1.4
--- src/usr.bin/make/unit-tests/directive-unexport.exp:1.3 Fri Oct 30 23:54:42 2020
+++ src/usr.bin/make/unit-tests/directive-unexport.exp Tue Nov 3 17:17:31 2020
@@ -2,4 +2,7 @@ make: "directive-unexport.mk" line 14: U
make: "directive-unexport.mk" line 15: UT_A UT_B UT_C
make: "directive-unexport.mk" line 23: UT_A=a UT_B=b UT_C=c
make: "directive-unexport.mk" line 24:
-exit status 0
+make: "directive-unexport.mk" line 26: Unknown directive "unexpor"
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
Index: src/usr.bin/make/unit-tests/directive-undef.mk
diff -u src/usr.bin/make/unit-tests/directive-undef.mk:1.4 src/usr.bin/make/unit-tests/directive-undef.mk:1.5
--- src/usr.bin/make/unit-tests/directive-undef.mk:1.4 Sat Oct 24 08:46:08 2020
+++ src/usr.bin/make/unit-tests/directive-undef.mk Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-undef.mk,v 1.4 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: directive-undef.mk,v 1.5 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .undef directive.
@@ -13,5 +13,9 @@
. warning $1$2$3
.endif
+.unde # misspelled
+.undef # oops: missing argument
+.undefined # oops: misspelled
+
all:
@:;
Index: src/usr.bin/make/unit-tests/directive-unexport.mk
diff -u src/usr.bin/make/unit-tests/directive-unexport.mk:1.4 src/usr.bin/make/unit-tests/directive-unexport.mk:1.5
--- src/usr.bin/make/unit-tests/directive-unexport.mk:1.4 Fri Oct 30 23:54:42 2020
+++ src/usr.bin/make/unit-tests/directive-unexport.mk Tue Nov 3 17:17:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-unexport.mk,v 1.4 2020/10/30 23:54:42 sjg Exp $
+# $NetBSD: directive-unexport.mk,v 1.5 2020/11/03 17:17:31 rillig Exp $
#
# Tests for the .unexport directive.
@@ -23,5 +23,9 @@ UT_C= c
.info ${:!env|sort|grep '^UT_'!}
.info ${.MAKE.EXPORTED}
+.unexpor # misspelled
+.unexport # oops: missing argument
+.unexporting works # oops: misspelled
+
all:
@:;