Tue Nov 3 17:37:57 2020 UTC ()
make(1): in test forloop.mk, replace shell execution with .info

It's easier to read in the code, and the output has line information to
better relate the output to the code.


(rillig)
diff -r1.3 -r1.4 src/usr.bin/make/unit-tests/forloop.exp
diff -r1.6 -r1.7 src/usr.bin/make/unit-tests/forloop.mk

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

--- src/usr.bin/make/unit-tests/Attic/forloop.exp 2020/10/25 16:15:48 1.3
+++ src/usr.bin/make/unit-tests/Attic/forloop.exp 2020/11/03 17:37:57 1.4
@@ -1,20 +1,20 @@ @@ -1,20 +1,20 @@
1x=one 1make: "forloop.mk" line 14: x=one
2x="two and three" 2make: "forloop.mk" line 14: x="two and three"
3x=four 3make: "forloop.mk" line 14: x=four
4x="five" 4make: "forloop.mk" line 14: x="five"
5x=-I/this 5make: "forloop.mk" line 20: x=-I/this
6x=-I"This or that" 6make: "forloop.mk" line 20: x=-I"This or that"
7x=-Ithat 7make: "forloop.mk" line 20: x=-Ithat
8x="-DTHIS=\"this and that\"" 8make: "forloop.mk" line 20: x="-DTHIS=\"this and that\""
9cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\"" 9make: "forloop.mk" line 27: cfl=-I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
10newline-item=(a) 10make: "forloop.mk" line 41: newline-item=(a)
11a=one b="two and three" 11make: "forloop.mk" line 47: a=one b="two and three"
12a=four b="five" 12make: "forloop.mk" line 47: a=four b="five"
13a=ONE b="TWO AND THREE" 13make: "forloop.mk" line 47: a=ONE b="TWO AND THREE"
14a=FOUR b="FIVE" 14make: "forloop.mk" line 47: a=FOUR b="FIVE"
15We expect an error next: 15We expect an error next:
16make: "forloop.mk" line 46: Wrong number of words (9) in .for substitution list with 2 variables 16make: "forloop.mk" line 46: Wrong number of words (9) in .for substitution list with 2 variables
17make: Fatal errors encountered -- cannot continue 17make: Fatal errors encountered -- cannot continue
18make: stopped in unit-tests 18make: stopped in unit-tests
19OK 19OK
20exit status 0 20exit status 0

cvs diff -r1.6 -r1.7 src/usr.bin/make/unit-tests/Attic/forloop.mk (expand / switch to unified diff)

--- src/usr.bin/make/unit-tests/Attic/forloop.mk 2020/10/24 08:50:17 1.6
+++ src/usr.bin/make/unit-tests/Attic/forloop.mk 2020/11/03 17:37:57 1.7
@@ -1,53 +1,53 @@ @@ -1,53 +1,53 @@
1# $NetBSD: forloop.mk,v 1.6 2020/10/24 08:50:17 rillig Exp $ 1# $NetBSD: forloop.mk,v 1.7 2020/11/03 17:37:57 rillig Exp $
2 2
3all: for-loop 3all: for-loop
4 4
5LIST= one "two and three" four "five" 5LIST= one "two and three" four "five"
6 6
7.if make(for-fail) 7.if make(for-fail)
8for-fail: 8for-fail:
9 9
10XTRA_LIST= xtra 10XTRA_LIST= xtra
11.else 11.else
12 12
13. for x in ${LIST} 13. for x in ${LIST}
14X!= echo 'x=$x' >&2; echo 14. info x=$x
15. endfor 15. endfor
16 16
17CFL= -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\"" 17CFL= -I/this -I"This or that" -Ithat "-DTHIS=\"this and that\""
18cfl= 18cfl=
19. for x in ${CFL} 19. for x in ${CFL}
20X!= echo 'x=$x' >&2; echo 20. info x=$x
21. if empty(cfl) 21. if empty(cfl)
22cfl= $x 22cfl= $x
23. else 23. else
24cfl+= $x 24cfl+= $x
25. endif 25. endif
26. endfor 26. endfor
27X!= echo 'cfl=${cfl}' >&2; echo 27. info cfl=${cfl}
28 28
29. if ${cfl} != ${CFL} 29. if ${cfl} != ${CFL}
30. error ${.newline}'${cfl}' != ${.newline}'${CFL}' 30. error ${.newline}${cfl} != ${.newline}${CFL}
31. endif 31. endif
32 32
33. for a b in ${EMPTY} 33. for a b in ${EMPTY}
34X!= echo 'a=$a b=$b' >&2; echo 34. info a=$a b=$b
35. endfor 35. endfor
36 36
37# Since at least 1993, iteration stops at the first newline. 37# Since at least 1993, iteration stops at the first newline.
38# Back then, the .newline variable didn't exist, therefore it was unlikely 38# Back then, the .newline variable didn't exist, therefore it was unlikely
39# that a newline ever occurred. 39# that a newline ever occurred.
40. for var in a${.newline}b${.newline}c 40. for var in a${.newline}b${.newline}c
41X!= echo 'newline-item=('${var:Q}')' 1>&2; echo 41. info newline-item=(${var})
42. endfor 42. endfor
43 43
44.endif # for-fail 44.endif # for-fail
45 45
46.for a b in ${LIST} ${LIST:tu} ${XTRA_LIST} 46.for a b in ${LIST} ${LIST:tu} ${XTRA_LIST}
47X!= echo 'a=$a b=$b' >&2; echo 47. info a=$a b=$b
48.endfor 48.endfor
49 49
50for-loop: 50for-loop:
51 @echo We expect an error next: 51 @echo We expect an error next:
52 @(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \ 52 @(cd ${.CURDIR} && ${.MAKE} -f ${MAKEFILE} for-fail) && \
53 { echo "Oops that should have failed!"; exit 1; } || echo OK 53 { echo "Oops that should have failed!"; exit 1; } || echo OK