Tue Jul 28 20:57:59 2020 UTC ()
make(1): add test for including a nonexistent or empty file


(rillig)
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/directives.exp
diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/directives.mk

cvs diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/Attic/directives.exp (switch to unified diff)

--- src/usr.bin/make/unit-tests/Attic/directives.exp 2020/07/28 18:25:33 1.4
+++ src/usr.bin/make/unit-tests/Attic/directives.exp 2020/07/28 20:57:59 1.5
@@ -1,41 +1,42 @@ @@ -1,41 +1,42 @@
1make: "directives.mk" line 10: begin .export tests 1make: "directives.mk" line 10: begin .export tests
2make: "directives.mk" line 11: Unknown directive "expor" 2make: "directives.mk" line 11: Unknown directive "expor"
3make: "directives.mk" line 20: begin .export-env tests 3make: "directives.mk" line 20: begin .export-env tests
4make: "directives.mk" line 30: begin .export-literal tests 4make: "directives.mk" line 30: begin .export-literal tests
5make: "directives.mk" line 40: begin .info tests 5make: "directives.mk" line 40: begin .info tests
6make: "directives.mk" line 41: Unknown directive "inf" 6make: "directives.mk" line 41: Unknown directive "inf"
7make: "directives.mk" line 42: Unknown directive "info" 7make: "directives.mk" line 42: Unknown directive "info"
8make: "directives.mk" line 43: message 8make: "directives.mk" line 43: message
9make: "directives.mk" line 44: indented message 9make: "directives.mk" line 44: indented message
10make: "directives.mk" line 45: Unknown directive "information" 10make: "directives.mk" line 45: Unknown directive "information"
11make: "directives.mk" line 46: message 11make: "directives.mk" line 46: message
12make: "directives.mk" line 50: begin .undef tests 12make: "directives.mk" line 50: begin .undef tests
13make: "directives.mk" line 51: Unknown directive "unde" 13make: "directives.mk" line 51: Unknown directive "unde"
14make: "directives.mk" line 60: begin .unexport tests 14make: "directives.mk" line 60: begin .unexport tests
15make: "directives.mk" line 61: Unknown directive "unexpor" 15make: "directives.mk" line 61: Unknown directive "unexpor"
16make: "directives.mk" line 70: begin .unexport-env tests 16make: "directives.mk" line 70: begin .unexport-env tests
17make: "directives.mk" line 80: begin .warning tests 17make: "directives.mk" line 80: begin .warning tests
18make: "directives.mk" line 81: Unknown directive "warn" 18make: "directives.mk" line 81: Unknown directive "warn"
19make: "directives.mk" line 82: Unknown directive "warnin" 19make: "directives.mk" line 82: Unknown directive "warnin"
20make: "directives.mk" line 83: Unknown directive "warning" 20make: "directives.mk" line 83: Unknown directive "warning"
21make: "directives.mk" line 84: warning: message 21make: "directives.mk" line 84: warning: message
22make: "directives.mk" line 85: Unknown directive "warnings" 22make: "directives.mk" line 85: Unknown directive "warnings"
23make: "directives.mk" line 86: warning: messages 23make: "directives.mk" line 86: warning: messages
24make: "directives.mk" line 90: begin .elif misspellings tests, part 1 24make: "directives.mk" line 90: begin .elif misspellings tests, part 1
25make: "directives.mk" line 100: begin .elif misspellings tests, part 2 25make: "directives.mk" line 100: begin .elif misspellings tests, part 2
26make: "directives.mk" line 110: begin .elif misspellings tests, part 3 26make: "directives.mk" line 110: begin .elif misspellings tests, part 3
27make: "directives.mk" line 120: which branch is taken on misspelling after false? 27make: "directives.mk" line 120: which branch is taken on misspelling after false?
28make: "directives.mk" line 127: else taken 28make: "directives.mk" line 127: else taken
29make: "directives.mk" line 130: which branch is taken on misspelling after true? 29make: "directives.mk" line 130: which branch is taken on misspelling after true?
30make: "directives.mk" line 132: Unknown directive "elsif" 30make: "directives.mk" line 132: Unknown directive "elsif"
31make: "directives.mk" line 133: 1 taken 31make: "directives.mk" line 133: 1 taken
32make: "directives.mk" line 134: Unknown directive "elsif" 32make: "directives.mk" line 134: Unknown directive "elsif"
33make: "directives.mk" line 135: 2 taken 33make: "directives.mk" line 135: 2 taken
34make: "directives.mk" line 140: Unknown directive "indented" 34make: "directives.mk" line 140: Unknown directive "indented"
35make: "directives.mk" line 141: Unknown directive "indented" 35make: "directives.mk" line 141: Unknown directive "indented"
36make: "directives.mk" line 142: Unknown directive "indented" 36make: "directives.mk" line 142: Unknown directive "indented"
37make: "directives.mk" line 143: Unknown directive "info" 37make: "directives.mk" line 143: Unknown directive "info"
38make: "directives.mk" line 150: end of the tests 38make: "directives.mk" line 150: Could not find nonexistent.mk
 39make: "directives.mk" line 160: end of the tests
39make: Fatal errors encountered -- cannot continue 40make: Fatal errors encountered -- cannot continue
40make: stopped in unit-tests 41make: stopped in unit-tests
41exit status 1 42exit status 1

cvs diff -r1.4 -r1.5 src/usr.bin/make/unit-tests/Attic/directives.mk (switch to unified diff)

--- src/usr.bin/make/unit-tests/Attic/directives.mk 2020/07/28 19:19:30 1.4
+++ src/usr.bin/make/unit-tests/Attic/directives.mk 2020/07/28 20:57:59 1.5
@@ -1,153 +1,163 @@ @@ -1,153 +1,163 @@
1# $NetBSD: directives.mk,v 1.4 2020/07/28 19:19:30 rillig Exp $ 1# $NetBSD: directives.mk,v 1.5 2020/07/28 20:57:59 rillig Exp $
2# 2#
3# Tests for parsing directives, in the same order as in the manual page. 3# Tests for parsing directives, in the same order as in the manual page.
4# 4#
5# Each test group has 10 lines, to keep the line numbers in directives.exp 5# Each test group has 10 lines, to keep the line numbers in directives.exp
6# stable. 6# stable.
7# 7#
8# no tests for .error since it exits immediately, see ParseMessage. 8# no tests for .error since it exits immediately, see ParseMessage.
9 9
10.info begin .export tests 10.info begin .export tests
11.expor # misspelled 11.expor # misspelled
12.export # oops: missing argument 12.export # oops: missing argument
13.export VARNAME 13.export VARNAME
14.exporting works # oops: misspelled 14.exporting works # oops: misspelled
15 15
16 16
17 17
18 18
19 19
20.info begin .export-env tests 20.info begin .export-env tests
21.export-en # oops: misspelled 21.export-en # oops: misspelled
22.export-env 22.export-env
23.export-environment # oops: misspelled 23.export-environment # oops: misspelled
24 24
25 25
26 26
27 27
28 28
29 29
30.info begin .export-literal tests 30.info begin .export-literal tests
31.export-litera # oops: misspelled 31.export-litera # oops: misspelled
32.export-literal # oops: missing argument 32.export-literal # oops: missing argument
33.export-literal VARNAME 33.export-literal VARNAME
34.export-literally # oops: misspelled 34.export-literally # oops: misspelled
35 35
36 36
37 37
38 38
39 39
40.info begin .info tests 40.info begin .info tests
41.inf # misspelled 41.inf # misspelled
42.info # oops: message should be "missing parameter" 42.info # oops: message should be "missing parameter"
43.info message 43.info message
44.info indented message 44.info indented message
45.information 45.information
46.information message # oops: misspelled 46.information message # oops: misspelled
47.info.man: # not a message, but a suffix rule 47.info.man: # not a message, but a suffix rule
48 48
49 49
50.info begin .undef tests 50.info begin .undef tests
51.unde # misspelled 51.unde # misspelled
52.undef # oops: missing argument 52.undef # oops: missing argument
53.undefined # oops: misspelled 53.undefined # oops: misspelled
54.undef VARNAME 54.undef VARNAME
55 55
56 56
57 57
58 58
59 59
60.info begin .unexport tests 60.info begin .unexport tests
61.unexpor # misspelled 61.unexpor # misspelled
62.unexport # oops: missing argument 62.unexport # oops: missing argument
63.unexport VARNAME # ok 63.unexport VARNAME # ok
64.unexporting works # oops: misspelled 64.unexporting works # oops: misspelled
65 65
66 66
67 67
68 68
69 69
70.info begin .unexport-env tests 70.info begin .unexport-env tests
71.unexport-en # misspelled 71.unexport-en # misspelled
72.unexport-env # ok 72.unexport-env # ok
73.unexport-environment # oops: misspelled 73.unexport-environment # oops: misspelled
74 74
75 75
76 76
77 77
78 78
79 79
80.info begin .warning tests 80.info begin .warning tests
81.warn # misspelled 81.warn # misspelled
82.warnin # misspelled 82.warnin # misspelled
83.warning # oops: should be "missing argument" 83.warning # oops: should be "missing argument"
84.warning message # ok 84.warning message # ok
85.warnings # misspelled 85.warnings # misspelled
86.warnings messages # oops 86.warnings messages # oops
87 87
88 88
89 89
90.info begin .elif misspellings tests, part 1 90.info begin .elif misspellings tests, part 1
91.if 1 91.if 1
92.elif 1 # ok 92.elif 1 # ok
93.elsif 1 # oops: misspelled 93.elsif 1 # oops: misspelled
94.elseif 1 # oops: misspelled 94.elseif 1 # oops: misspelled
95.endif 95.endif
96 96
97 97
98 98
99 99
100.info begin .elif misspellings tests, part 2 100.info begin .elif misspellings tests, part 2
101.if 0 101.if 0
102.elif 0 # ok 102.elif 0 # ok
103.elsif 0 # oops: misspelled 103.elsif 0 # oops: misspelled
104.elseif 0 # oops: misspelled 104.elseif 0 # oops: misspelled
105.endif 105.endif
106 106
107 107
108 108
109 109
110.info begin .elif misspellings tests, part 3 110.info begin .elif misspellings tests, part 3
111.if 0 111.if 0
112.elsif 0 # oops: misspelled 112.elsif 0 # oops: misspelled
113.endif 113.endif
114.if 0 114.if 0
115.elseif 0 # oops: misspelled 115.elseif 0 # oops: misspelled
116.endif 116.endif
117 117
118 118
119 119
120.info which branch is taken on misspelling after false? 120.info which branch is taken on misspelling after false?
121.if 0 121.if 0
122.elsif 1 122.elsif 1
123.info 1 taken 123.info 1 taken
124.elsif 2 124.elsif 2
125.info 2 taken 125.info 2 taken
126.else 126.else
127.info else taken 127.info else taken
128.endif 128.endif
129 129
130.info which branch is taken on misspelling after true? 130.info which branch is taken on misspelling after true?
131.if 1 131.if 1
132.elsif 1 132.elsif 1
133.info 1 taken 133.info 1 taken
134.elsif 2 134.elsif 2
135.info 2 taken 135.info 2 taken
136.else 136.else
137.info else taken 137.info else taken
138.endif 138.endif
139 139
140.indented none 140.indented none
141. indented 2 spaces 141. indented 2 spaces
142. indented tab 142. indented tab
143.${:Uinfo} directives cannot be indirect 143.${:Uinfo} directives cannot be indirect
144 144
145 145
146 146
147 147
148 148
149 149
 150.include "nonexistent.mk"
 151.include "/dev/null" # size 0
 152# including a directory technically succeeds, but shouldn't.
 153#.include "." # directory
 154
 155
 156
 157
 158
 159
150.info end of the tests 160.info end of the tests
151 161
152all: 162all:
153 @: 163 @: