aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-10-16 12:58:07 +0100
committerRon Yorston <rmy@pobox.com>2022-10-16 12:58:07 +0100
commitb749a2c0eb47b648805500c23ffbe4550e976a57 (patch)
tree5c4afabf0c5bd3d96dd39c70f036b94323173e9d /testsuite
parent2a487dd89a36f712b8d81058262da267b98f54ef (diff)
downloadbusybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.tar.gz
busybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.tar.bz2
busybox-w32-b749a2c0eb47b648805500c23ffbe4550e976a57.zip
make: clarify output of tests
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/make.tests62
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
7testing "Basic makefile" \ 7testing "make basic makefile" \
8 "make -f -" "target\n" "" ' 8 "make -f -" "target\n" "" '
9target: 9target:
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.
15testing ".DEFAULT rule" \ 15testing "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.
27testing "Macro expansion and suffix substitution" \ 27testing "make macro expansion and suffix substitution" \
28 "make -f -" "src1.o src2.o\n" "" ' 28 "make -f -" "src1.o src2.o\n" "" '
29DOTC = .c 29DOTC = .c
30DOTO = .o 30DOTO = .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.
39testing "Macro expansion and suffix substitution 2" \ 39testing "make macro expansion and suffix substitution 2" \
40 "make -f -" "src1.o src2.o\n" "" ' 40 "make -f -" "src1.o src2.o\n" "" '
41DOTS = .c=.o 41DOTS = .c=.o
42SRC1 = src1.c 42SRC1 = 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.
50mkdir make.tempdir && cd make.tempdir || exit 1 50mkdir make.tempdir && cd make.tempdir || exit 1
51testing "Inference rule with explicit rule for prerequisite" \ 51testing "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
54x.q: 54x.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.
64testing "Appending to immediate-expansion macro" \ 64testing "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" "" '
67world = 1 67world = 1
@@ -87,7 +87,7 @@ target:
87' 87'
88 88
89# basic pattern macro expansion 89# basic pattern macro expansion
90testing "Basic pattern macro expansion" \ 90testing "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" "" '
93SRC = src/util.c src/main.c 93SRC = 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
101testing "Pattern macro expansion; match any value" \ 101testing "make pattern macro expansion; match any value" \
102 "make -f -" \ 102 "make -f -" \
103 "any_value.o\n" "" ' 103 "any_value.o\n" "" '
104SRC = any_value 104SRC = 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
112testing "Pattern macro expansion with empty rvalue" \ 112testing "make pattern macro expansion with empty rvalue" \
113 "make -f -" \ 113 "make -f -" \
114 "\n" "" ' 114 "\n" "" '
115SRC = util.c main.c 115SRC = 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.
125testing "Pattern macro expansion with multiple <percent> in rvalue" \ 125testing "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" "" '
128SRC = main.c 128SRC = main.c
@@ -133,7 +133,7 @@ target:
133' 133'
134 134
135# pattern macro expansion; zero match 135# pattern macro expansion; zero match
136testing "Pattern macro expansion; zero match" \ 136testing "make pattern macro expansion; zero match" \
137 "make -f -" \ 137 "make -f -" \
138 "nsnp\n" "" ' 138 "nsnp\n" "" '
139WORD = osop 139WORD = 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
147testing "Basic MAKE macro expansion" \ 147testing "make basic MAKE macro expansion" \
148 "make -f -" \ 148 "make -f -" \
149 "make\n" "" ' 149 "make\n" "" '
150target: 150target:
@@ -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
155testing "MAKE macro expansion; overwrite with env macro" \ 155testing "make MAKE macro expansion; overwrite with env macro" \
156 "MAKE=hello make -f -" \ 156 "MAKE=hello make -f -" \
157 "hello\n" "" ' 157 "hello\n" "" '
158target: 158target:
@@ -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
164testing "MAKE macro expansion; overwrite with command-line macro" \ 164testing "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" "" '
167MAKE = test 167MAKE = 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]
175testing "MAKE macro expansion; turn relative path into absolute" \ 175testing "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" "" '
178target: 178target:
@@ -184,7 +184,7 @@ target:
184touch -t 202206171200 file1 184touch -t 202206171200 file1
185touch -t 202206171201 target 185touch -t 202206171201 target
186touch -t 202206171202 file2 186touch -t 202206171202 file2
187testing "Compare \$? and \$^ internal macros" \ 187testing "make compare \$? and \$^ internal macros" \
188 "make -f -" \ 188 "make -f -" \
189 "file2\nfile1 file2\n" "" ' 189 "file2\nfile1 file2\n" "" '
190target: file1 file2 190target: 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.
198touch -t 202206171201 target 198touch -t 202206171201 target
199testing "Phony target" \ 199testing "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:
207rm -f target 207rm -f target
208 208
209# Phony targets aren't touched with -t 209# Phony targets aren't touched with -t
210testing "Phony target not touched" \ 210testing "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
220mkdir make.tempdir && cd make.tempdir || exit 1 220mkdir make.tempdir && cd make.tempdir || exit 1
221testing "Create include file" \ 221testing "make create include file" \
222 "make -f -" \ 222 "make -f -" \
223 "made\n" "" ' 223 "made\n" "" '
224target: 224target:
@@ -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.
234mkdir make.tempdir && cd make.tempdir || exit 1 234mkdir make.tempdir && cd make.tempdir || exit 1
235testing "Create include file even with -n" \ 235testing "make create include file even with -n" \
236 "make -n -f -" \ 236 "make -n -f -" \
237 "echo made\n" "" ' 237 "echo made\n" "" '
238target: 238target:
@@ -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.)
248testing "Failure to create include file is OK" \ 248testing "make failure to create include file is OK" \
249 "make -f -" \ 249 "make -f -" \
250 "OK\n" "" ' 250 "OK\n" "" '
251target: 251target:
@@ -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.
260testing "Nested macro expansion" \ 260testing "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" "" '
262a = b 262a = b
263b = c 263b = c
@@ -273,7 +273,7 @@ target:
273 @echo 5 $($a$b$c) 273 @echo 5 $($a$b$c)
274' 274'
275 275
276testing "Double-colon rule" \ 276testing "make double-colon rule" \
277 "make -f -" "target1\ntarget2\n" "" ' 277 "make -f -" "target1\ntarget2\n" "" '
278target:: 278target::
279 @echo target1 279 @echo target1
@@ -289,7 +289,7 @@ touch -t 202206171200 file1
289touch -t 202206171201 intermediate 289touch -t 202206171201 intermediate
290touch -t 202206171202 target 290touch -t 202206171202 target
291touch -t 202206171203 file2 291touch -t 202206171203 file2
292testing "Target depends on prerequisite updated by double-colon rule" \ 292testing "make target depends on prerequisite updated by double-colon rule" \
293 "make -f -" \ 293 "make -f -" \
294 "file2\n" "" ' 294 "file2\n" "" '
295target: intermediate 295target: 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.
305mkdir make.tempdir && cd make.tempdir || exit 1 305mkdir make.tempdir && cd make.tempdir || exit 1
306touch target.p 306touch target.p
307testing "Chained inference rules" \ 307testing "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" \
321cd .. || exit 1; rm -rf make.tempdir 2>/dev/null 321cd .. || 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.
324testing "Shell assignment" \ 324testing "make shell assignment" \
325 "make -f -" \ 325 "make -f -" \
326 "1 2 3 4\n" "" ' 326 "1 2 3 4\n" "" '
327hello != echo 1; echo 2; echo 3; echo; echo 327hello != echo 1; echo 2; echo 3; echo; echo
@@ -335,7 +335,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
335mkdir make.tempdir && cd make.tempdir || exit 1 335mkdir make.tempdir && cd make.tempdir || exit 1
336touch -t 202206171201 t1a t2aa t3b 336touch -t 202206171201 t1a t2aa t3b
337touch s1a s2aa s3b 337touch s1a s2aa s3b
338testing "Expand wildcards in filenames" \ 338testing "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" "" '
341t1? t2* t3[abc]: s1? s2* s3[abc] 341t1? t2* t3[abc]: s1? s2* s3[abc]
@@ -348,7 +348,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1
348touch -t 202206171200 file1 file3 348touch -t 202206171200 file1 file3
349touch -t 202206171201 target 349touch -t 202206171201 target
350touch -t 202206171202 file2 350touch -t 202206171202 file2
351testing "Skip duplicate entries in \$? and \$^" \ 351testing "make skip duplicate entries in \$? and \$^" \
352 "make -f -" \ 352 "make -f -" \
353 "file2\nfile1 file2 file3\n" "" ' 353 "file2\nfile1 file2 file3\n" "" '
354target: file1 file2 file2 file3 file3 354target: file1 file2 file2 file3 file3
@@ -363,7 +363,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1
363touch -t 202206171200 file1 file3 363touch -t 202206171200 file1 file3
364touch -t 202206171201 target 364touch -t 202206171201 target
365touch -t 202206171202 file2 365touch -t 202206171202 file2
366testing "Skip duplicate entries: double-colon rules" \ 366testing "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" "" '
369target:: file1 file3 file1 file2 file3 369target:: file1 file3 file1 file2 file3
@@ -381,7 +381,7 @@ mkdir make.tempdir && cd make.tempdir || exit 1
381touch -t 202206171200 file1 file3 381touch -t 202206171200 file1 file3
382touch -t 202206171201 target 382touch -t 202206171201 target
383touch -t 202206171202 file2 383touch -t 202206171202 file2
384testing "Skip duplicate entries: double-colon rules, only second invoked" \ 384testing "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" "" '
387target:: file1 file3 file1 file3 387target:: file1 file3 file1 file3
@@ -399,7 +399,7 @@ cd .. || exit 1; rm -rf make.tempdir 2>/dev/null
399mkdir make.tempdir && cd make.tempdir || exit 1 399mkdir make.tempdir && cd make.tempdir || exit 1
400touch -t 202206171200 file1 400touch -t 202206171200 file1
401touch -t 202206171201 target 401touch -t 202206171201 target
402testing "Phony target of double-colon rule" \ 402testing "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