diff options
author | Ron Yorston <rmy@pobox.com> | 2022-10-16 12:58:07 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2022-10-16 12:58:07 +0100 |
commit | b749a2c0eb47b648805500c23ffbe4550e976a57 (patch) | |
tree | 5c4afabf0c5bd3d96dd39c70f036b94323173e9d /testsuite | |
parent | 2a487dd89a36f712b8d81058262da267b98f54ef (diff) | |
download | busybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.tar.gz busybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.tar.bz2 busybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.zip |
make: clarify output of tests
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/make.tests | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/testsuite/make.tests b/testsuite/make.tests index 75091b0f7..3d0d14dd0 100755 --- a/testsuite/make.tests +++ b/testsuite/make.tests | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | # testing "test name" "command" "expected result" "file input" "stdin" | 5 | # testing "test name" "command" "expected result" "file input" "stdin" |
6 | 6 | ||
7 | testing "Basic makefile" \ | 7 | testing "make basic makefile" \ |
8 | "make -f -" "target\n" "" ' | 8 | "make -f -" "target\n" "" ' |
9 | target: | 9 | target: |
10 | @echo target | 10 | @echo target |
@@ -12,7 +12,7 @@ target: | |||
12 | 12 | ||
13 | # .DEFAULT rules with no commands or some prerequisites are ignored. | 13 | # .DEFAULT rules with no commands or some prerequisites are ignored. |
14 | # .DEFAULT rules with commands can be redefined. | 14 | # .DEFAULT rules with commands can be redefined. |
15 | testing ".DEFAULT rule" \ | 15 | testing "make .DEFAULT rule" \ |
16 | "make -f - default" "default2\n" "" ' | 16 | "make -f - default" "default2\n" "" ' |
17 | .DEFAULT: ignored | 17 | .DEFAULT: ignored |
18 | .DEFAULT: | 18 | .DEFAULT: |
@@ -24,7 +24,7 @@ target: | |||
24 | 24 | ||
25 | # Macros should be expanded before suffix substitution. The suffixes | 25 | # Macros should be expanded before suffix substitution. The suffixes |
26 | # can be obtained by macro expansion. | 26 | # can be obtained by macro expansion. |
27 | testing "Macro expansion and suffix substitution" \ | 27 | testing "make macro expansion and suffix substitution" \ |
28 | "make -f -" "src1.o src2.o\n" "" ' | 28 | "make -f -" "src1.o src2.o\n" "" ' |
29 | DOTC = .c | 29 | DOTC = .c |
30 | DOTO = .o | 30 | DOTO = .o |
@@ -36,7 +36,7 @@ target: | |||
36 | 36 | ||
37 | # Indeed, everything after the <colon> can be obtained by macro | 37 | # Indeed, everything after the <colon> can be obtained by macro |
38 | # macro expansion. | 38 | # macro expansion. |
39 | testing "Macro expansion and suffix substitution 2" \ | 39 | testing "make macro expansion and suffix substitution 2" \ |
40 | "make -f -" "src1.o src2.o\n" "" ' | 40 | "make -f -" "src1.o src2.o\n" "" ' |
41 | DOTS = .c=.o | 41 | DOTS = .c=.o |
42 | SRC1 = src1.c | 42 | SRC1 = src1.c |
@@ -48,7 +48,7 @@ target: | |||
48 | # It should be possible for an inference rule to determine that a | 48 | # It should be possible for an inference rule to determine that a |
49 | # prerequisite can be created using an explicit rule. | 49 | # prerequisite can be created using an explicit rule. |
50 | mkdir make.tempdir && cd make.tempdir || exit 1 | 50 | mkdir make.tempdir && cd make.tempdir || exit 1 |
51 | testing "Inference rule with explicit rule for prerequisite" \ | 51 | testing "make inference rule with explicit rule for prerequisite" \ |
52 | "make -f -" "touch x.p\ncat x.p >x.q\n" "" ' | 52 | "make -f -" "touch x.p\ncat x.p >x.q\n" "" ' |
53 | .SUFFIXES: .p .q | 53 | .SUFFIXES: .p .q |
54 | x.q: | 54 | x.q: |
@@ -61,7 +61,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
61 | 61 | ||
62 | # A macro created using ::= remembers it's of type immediate-expansion. | 62 | # A macro created using ::= remembers it's of type immediate-expansion. |
63 | # Immediate expansion also occurs when += is used to append to such a macro. | 63 | # Immediate expansion also occurs when += is used to append to such a macro. |
64 | testing "Appending to immediate-expansion macro" \ | 64 | testing "make appending to immediate-expansion macro" \ |
65 | "make -f -" \ | 65 | "make -f -" \ |
66 | "hello 1 2 3\nhello 4 4\n" "" ' | 66 | "hello 1 2 3\nhello 4 4\n" "" ' |
67 | world = 1 | 67 | world = 1 |
@@ -87,7 +87,7 @@ target: | |||
87 | ' | 87 | ' |
88 | 88 | ||
89 | # basic pattern macro expansion | 89 | # basic pattern macro expansion |
90 | testing "Basic pattern macro expansion" \ | 90 | testing "make basic pattern macro expansion" \ |
91 | "make -f -" \ | 91 | "make -f -" \ |
92 | "obj/util.o obj/main.o\n" "" ' | 92 | "obj/util.o obj/main.o\n" "" ' |
93 | SRC = src/util.c src/main.c | 93 | SRC = src/util.c src/main.c |
@@ -98,7 +98,7 @@ target: | |||
98 | ' | 98 | ' |
99 | 99 | ||
100 | # pattern macro expansion; match any value | 100 | # pattern macro expansion; match any value |
101 | testing "Pattern macro expansion; match any value" \ | 101 | testing "make pattern macro expansion; match any value" \ |
102 | "make -f -" \ | 102 | "make -f -" \ |
103 | "any_value.o\n" "" ' | 103 | "any_value.o\n" "" ' |
104 | SRC = any_value | 104 | SRC = any_value |
@@ -109,7 +109,7 @@ target: | |||
109 | ' | 109 | ' |
110 | 110 | ||
111 | # pattern macro expansion with empty rvalue | 111 | # pattern macro expansion with empty rvalue |
112 | testing "Pattern macro expansion with empty rvalue" \ | 112 | testing "make pattern macro expansion with empty rvalue" \ |
113 | "make -f -" \ | 113 | "make -f -" \ |
114 | "\n" "" ' | 114 | "\n" "" ' |
115 | SRC = util.c main.c | 115 | SRC = util.c main.c |
@@ -122,7 +122,7 @@ target: | |||
122 | # pattern macro expansion with multiple <percent> in rvalue | 122 | # pattern macro expansion with multiple <percent> in rvalue |
123 | # POSIX requires the first <percent> to be expanded, others | 123 | # POSIX requires the first <percent> to be expanded, others |
124 | # may or may not be expanded. Permit either case. | 124 | # may or may not be expanded. Permit either case. |
125 | testing "Pattern macro expansion with multiple <percent> in rvalue" \ | 125 | testing "make pattern macro expansion with multiple <percent> in rvalue" \ |
126 | "make -f - | sed 's/mainmainmain/main%%/'" \ | 126 | "make -f - | sed 's/mainmainmain/main%%/'" \ |
127 | "main%%\n" "" ' | 127 | "main%%\n" "" ' |
128 | SRC = main.c | 128 | SRC = main.c |
@@ -133,7 +133,7 @@ target: | |||
133 | ' | 133 | ' |
134 | 134 | ||
135 | # pattern macro expansion; zero match | 135 | # pattern macro expansion; zero match |
136 | testing "Pattern macro expansion; zero match" \ | 136 | testing "make pattern macro expansion; zero match" \ |
137 | "make -f -" \ | 137 | "make -f -" \ |
138 | "nsnp\n" "" ' | 138 | "nsnp\n" "" ' |
139 | WORD = osop | 139 | WORD = osop |
@@ -144,7 +144,7 @@ target: | |||
144 | ' | 144 | ' |
145 | 145 | ||
146 | # Check that MAKE will contain argv[0], e.g make in this case | 146 | # Check that MAKE will contain argv[0], e.g make in this case |
147 | testing "Basic MAKE macro expansion" \ | 147 | testing "make basic MAKE macro expansion" \ |
148 | "make -f -" \ | 148 | "make -f -" \ |
149 | "make\n" "" ' | 149 | "make\n" "" ' |
150 | target: | 150 | target: |
@@ -152,7 +152,7 @@ target: | |||
152 | ' | 152 | ' |
153 | 153 | ||
154 | # Check that MAKE defined as environment variable will overwrite default MAKE | 154 | # Check that MAKE defined as environment variable will overwrite default MAKE |
155 | testing "MAKE macro expansion; overwrite with env macro" \ | 155 | testing "make MAKE macro expansion; overwrite with env macro" \ |
156 | "MAKE=hello make -f -" \ | 156 | "MAKE=hello make -f -" \ |
157 | "hello\n" "" ' | 157 | "hello\n" "" ' |
158 | target: | 158 | target: |
@@ -161,7 +161,7 @@ target: | |||
161 | 161 | ||
162 | # Check that MAKE defined on the command-line will overwrite MAKE defined in | 162 | # Check that MAKE defined on the command-line will overwrite MAKE defined in |
163 | # Makefile | 163 | # Makefile |
164 | testing "MAKE macro expansion; overwrite with command-line macro" \ | 164 | testing "make MAKE macro expansion; overwrite with command-line macro" \ |
165 | "make -f - MAKE=hello" \ | 165 | "make -f - MAKE=hello" \ |
166 | "hello\n" "" ' | 166 | "hello\n" "" ' |
167 | MAKE = test | 167 | MAKE = test |
@@ -172,7 +172,7 @@ target: | |||
172 | 172 | ||
173 | # POSIX draft states that if make was invoked using relative path, MAKE must | 173 | # POSIX draft states that if make was invoked using relative path, MAKE must |
174 | # contain absolute path, not just argv[0] | 174 | # contain absolute path, not just argv[0] |
175 | testing "MAKE macro expansion; turn relative path into absolute" \ | 175 | testing "make MAKE macro expansion; turn relative path into absolute" \ |
176 | "../runtest-tempdir-links/make -f -" \ | 176 | "../runtest-tempdir-links/make -f -" \ |
177 | "ok\n" "" ' | 177 | "ok\n" "" ' |
178 | target: | 178 | target: |
@@ -184,7 +184,7 @@ target: | |||
184 | touch -t 202206171200 file1 | 184 | touch -t 202206171200 file1 |
185 | touch -t 202206171201 target | 185 | touch -t 202206171201 target |
186 | touch -t 202206171202 file2 | 186 | touch -t 202206171202 file2 |
187 | testing "Compare \$? and \$^ internal macros" \ | 187 | testing "make compare \$? and \$^ internal macros" \ |
188 | "make -f -" \ | 188 | "make -f -" \ |
189 | "file2\nfile1 file2\n" "" ' | 189 | "file2\nfile1 file2\n" "" ' |
190 | target: file1 file2 | 190 | target: file1 file2 |
@@ -196,7 +196,7 @@ rm -f target file1 file2 | |||
196 | # Phony targets are executed (once) even if a matching file exists. | 196 | # Phony targets are executed (once) even if a matching file exists. |
197 | # A .PHONY target with no prerequisites is ignored. | 197 | # A .PHONY target with no prerequisites is ignored. |
198 | touch -t 202206171201 target | 198 | touch -t 202206171201 target |
199 | testing "Phony target" \ | 199 | testing "make phony target" \ |
200 | "make -f -" \ | 200 | "make -f -" \ |
201 | "phony\n" "" ' | 201 | "phony\n" "" ' |
202 | .PHONY: target | 202 | .PHONY: target |
@@ -207,7 +207,7 @@ target: | |||
207 | rm -f target | 207 | rm -f target |
208 | 208 | ||
209 | # Phony targets aren't touched with -t | 209 | # Phony targets aren't touched with -t |
210 | testing "Phony target not touched" \ | 210 | testing "make phony target not touched" \ |
211 | "make -t -f - >/dev/null && test -f target && echo target" \ | 211 | "make -t -f - >/dev/null && test -f target && echo target" \ |
212 | "" "" ' | 212 | "" "" ' |
213 | .PHONY: target | 213 | .PHONY: target |
@@ -218,7 +218,7 @@ rm -f target | |||
218 | 218 | ||
219 | # Include files are created or brought up-to-date | 219 | # Include files are created or brought up-to-date |
220 | mkdir make.tempdir && cd make.tempdir || exit 1 | 220 | mkdir make.tempdir && cd make.tempdir || exit 1 |
221 | testing "Create include file" \ | 221 | testing "make create include file" \ |
222 | "make -f -" \ | 222 | "make -f -" \ |
223 | "made\n" "" ' | 223 | "made\n" "" ' |
224 | target: | 224 | target: |
@@ -232,7 +232,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
232 | # Include files are created or brought up-to-date even when the -n | 232 | # Include files are created or brought up-to-date even when the -n |
233 | # option is given. | 233 | # option is given. |
234 | mkdir make.tempdir && cd make.tempdir || exit 1 | 234 | mkdir make.tempdir && cd make.tempdir || exit 1 |
235 | testing "Create include file even with -n" \ | 235 | testing "make create include file even with -n" \ |
236 | "make -n -f -" \ | 236 | "make -n -f -" \ |
237 | "echo made\n" "" ' | 237 | "echo made\n" "" ' |
238 | target: | 238 | target: |
@@ -245,7 +245,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
245 | 245 | ||
246 | # Failure to create an include file isn't an error. (Provided the | 246 | # Failure to create an include file isn't an error. (Provided the |
247 | # include line is ignoring non-existent files.) | 247 | # include line is ignoring non-existent files.) |
248 | testing "Failure to create include file is OK" \ | 248 | testing "make failure to create include file is OK" \ |
249 | "make -f -" \ | 249 | "make -f -" \ |
250 | "OK\n" "" ' | 250 | "OK\n" "" ' |
251 | target: | 251 | target: |
@@ -257,7 +257,7 @@ mk: | |||
257 | 257 | ||
258 | # Nested macro expansion is allowed. This should be compatible | 258 | # Nested macro expansion is allowed. This should be compatible |
259 | # with other implementations. | 259 | # with other implementations. |
260 | testing "Nested macro expansion" \ | 260 | testing "make nested macro expansion" \ |
261 | "make -f -" "0 bc\n1 d\n2\n3\n4 bcd\n5 bcd\n" "" ' | 261 | "make -f -" "0 bc\n1 d\n2\n3\n4 bcd\n5 bcd\n" "" ' |
262 | a = b | 262 | a = b |
263 | b = c | 263 | b = c |
@@ -273,7 +273,7 @@ target: | |||
273 | @echo 5 $($a$b$c) | 273 | @echo 5 $($a$b$c) |
274 | ' | 274 | ' |
275 | 275 | ||
276 | testing "Double-colon rule" \ | 276 | testing "make double-colon rule" \ |
277 | "make -f -" "target1\ntarget2\n" "" ' | 277 | "make -f -" "target1\ntarget2\n" "" ' |
278 | target:: | 278 | target:: |
279 | @echo target1 | 279 | @echo target1 |
@@ -289,7 +289,7 @@ touch -t 202206171200 file1 | |||
289 | touch -t 202206171201 intermediate | 289 | touch -t 202206171201 intermediate |
290 | touch -t 202206171202 target | 290 | touch -t 202206171202 target |
291 | touch -t 202206171203 file2 | 291 | touch -t 202206171203 file2 |
292 | testing "Target depends on prerequisite updated by double-colon rule" \ | 292 | testing "make target depends on prerequisite updated by double-colon rule" \ |
293 | "make -f -" \ | 293 | "make -f -" \ |
294 | "file2\n" "" ' | 294 | "file2\n" "" ' |
295 | target: intermediate | 295 | target: intermediate |
@@ -304,7 +304,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
304 | # Use chained inference rules to determine prerequisites. | 304 | # Use chained inference rules to determine prerequisites. |
305 | mkdir make.tempdir && cd make.tempdir || exit 1 | 305 | mkdir make.tempdir && cd make.tempdir || exit 1 |
306 | touch target.p | 306 | touch target.p |
307 | testing "Chained inference rules" \ | 307 | testing "make chained inference rules" \ |
308 | "make -s -f - target.s" \ | 308 | "make -s -f - target.s" \ |
309 | "target.q\ntarget.r\ntarget.s\n" "" ' | 309 | "target.q\ntarget.r\ntarget.s\n" "" ' |
310 | .SUFFIXES: .p .q .r .s | 310 | .SUFFIXES: .p .q .r .s |
@@ -321,7 +321,7 @@ testing "Chained inference rules" \ | |||
321 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | 321 | cd .. || exit 1; rm -rf make.tempdir 2>/dev/null |
322 | 322 | ||
323 | # Assign the output of a shell command to a macro. | 323 | # Assign the output of a shell command to a macro. |
324 | testing "Shell assignment" \ | 324 | testing "make shell assignment" \ |
325 | "make -f -" \ | 325 | "make -f -" \ |
326 | "1 2 3 4\n" "" ' | 326 | "1 2 3 4\n" "" ' |
327 | hello != echo 1; echo 2; echo 3; echo; echo | 327 | hello != echo 1; echo 2; echo 3; echo; echo |
@@ -335,7 +335,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
335 | mkdir make.tempdir && cd make.tempdir || exit 1 | 335 | mkdir make.tempdir && cd make.tempdir || exit 1 |
336 | touch -t 202206171201 t1a t2aa t3b | 336 | touch -t 202206171201 t1a t2aa t3b |
337 | touch s1a s2aa s3b | 337 | touch s1a s2aa s3b |
338 | testing "Expand wildcards in filenames" \ | 338 | testing "make expand wildcards in filenames" \ |
339 | "make -f - t1a t2aa t3b" \ | 339 | "make -f - t1a t2aa t3b" \ |
340 | "t1a s1a s2aa s3b\nt2aa s1a s2aa s3b\nt3b s1a s2aa s3b\n" "" ' | 340 | "t1a s1a s2aa s3b\nt2aa s1a s2aa s3b\nt3b s1a s2aa s3b\n" "" ' |
341 | t1? t2* t3[abc]: s1? s2* s3[abc] | 341 | t1? t2* t3[abc]: s1? s2* s3[abc] |
@@ -348,7 +348,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1 | |||
348 | touch -t 202206171200 file1 file3 | 348 | touch -t 202206171200 file1 file3 |
349 | touch -t 202206171201 target | 349 | touch -t 202206171201 target |
350 | touch -t 202206171202 file2 | 350 | touch -t 202206171202 file2 |
351 | testing "Skip duplicate entries in \$? and \$^" \ | 351 | testing "make skip duplicate entries in \$? and \$^" \ |
352 | "make -f -" \ | 352 | "make -f -" \ |
353 | "file2\nfile1 file2 file3\n" "" ' | 353 | "file2\nfile1 file2 file3\n" "" ' |
354 | target: file1 file2 file2 file3 file3 | 354 | target: file1 file2 file2 file3 file3 |
@@ -363,7 +363,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1 | |||
363 | touch -t 202206171200 file1 file3 | 363 | touch -t 202206171200 file1 file3 |
364 | touch -t 202206171201 target | 364 | touch -t 202206171201 target |
365 | touch -t 202206171202 file2 | 365 | touch -t 202206171202 file2 |
366 | testing "Skip duplicate entries: double-colon rules" \ | 366 | testing "make skip duplicate entries: double-colon rules" \ |
367 | "make -f -" \ | 367 | "make -f -" \ |
368 | "file2\nfile1 file3 file2\nfile2\nfile2 file3\n" "" ' | 368 | "file2\nfile1 file3 file2\nfile2\nfile2 file3\n" "" ' |
369 | target:: file1 file3 file1 file2 file3 | 369 | target:: file1 file3 file1 file2 file3 |
@@ -381,7 +381,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1 | |||
381 | touch -t 202206171200 file1 file3 | 381 | touch -t 202206171200 file1 file3 |
382 | touch -t 202206171201 target | 382 | touch -t 202206171201 target |
383 | touch -t 202206171202 file2 | 383 | touch -t 202206171202 file2 |
384 | testing "Skip duplicate entries: double-colon rules, only second invoked" \ | 384 | testing "make skip duplicate entries: double-colon rules, only second invoked" \ |
385 | "make -f -" \ | 385 | "make -f -" \ |
386 | "file2\nfile2 file3\n" "" ' | 386 | "file2\nfile2 file3\n" "" ' |
387 | target:: file1 file3 file1 file3 | 387 | target:: file1 file3 file1 file3 |
@@ -399,7 +399,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null | |||
399 | mkdir make.tempdir && cd make.tempdir || exit 1 | 399 | mkdir make.tempdir && cd make.tempdir || exit 1 |
400 | touch -t 202206171200 file1 | 400 | touch -t 202206171200 file1 |
401 | touch -t 202206171201 target | 401 | touch -t 202206171201 target |
402 | testing "Phony target of double-colon rule" \ | 402 | testing "make phony target of double-colon rule" \ |
403 | "make -f - 2>&1" \ | 403 | "make -f - 2>&1" \ |
404 | "unconditional\nconditional\n" "" ' | 404 | "unconditional\nconditional\n" "" ' |
405 | .PHONY: target | 405 | .PHONY: target |