xref: /freebsd/contrib/bmake/unit-tests/opt-debug-errors.mk (revision 956e45f6fb3e18b8e89b1341708db60c30bb9f27)
1*956e45f6SSimon J. Gerraty# $NetBSD: opt-debug-errors.mk,v 1.2 2020/09/06 04:35:03 rillig Exp $
2*956e45f6SSimon J. Gerraty#
3*956e45f6SSimon J. Gerraty# Tests for the -de command line option, which adds debug logging for
4*956e45f6SSimon J. Gerraty# failed commands and targets.
5*956e45f6SSimon J. Gerraty
6*956e45f6SSimon J. Gerraty.MAKEFLAGS: -de
7*956e45f6SSimon J. Gerraty
8*956e45f6SSimon J. Gerratyall: fail-spaces
9*956e45f6SSimon J. Gerratyall: fail-escaped-space
10*956e45f6SSimon J. Gerratyall: fail-newline
11*956e45f6SSimon J. Gerratyall: fail-multiline
12*956e45f6SSimon J. Gerratyall: fail-multiline-intention
13*956e45f6SSimon J. Gerraty
14*956e45f6SSimon J. Gerraty# XXX: The debug output folds the spaces, showing '3 spaces' instead of
15*956e45f6SSimon J. Gerraty# the correct '3   spaces'.
16*956e45f6SSimon J. Gerratyfail-spaces:
17*956e45f6SSimon J. Gerraty	echo '3   spaces'; false
18*956e45f6SSimon J. Gerraty
19*956e45f6SSimon J. Gerraty# XXX: The debug output folds the spaces, showing 'echo \ indented' instead
20*956e45f6SSimon J. Gerraty# of the correct 'echo \  indented'.
21*956e45f6SSimon J. Gerratyfail-escaped-space:
22*956e45f6SSimon J. Gerraty	echo \  indented; false
23*956e45f6SSimon J. Gerraty
24*956e45f6SSimon J. Gerraty# XXX: A newline is turned into an ordinary space in the debug log.
25*956e45f6SSimon J. Gerratyfail-newline:
26*956e45f6SSimon J. Gerraty	echo 'line1${.newline}line2'; false
27*956e45f6SSimon J. Gerraty
28*956e45f6SSimon J. Gerraty# The line continuations in multiline commands are turned into an ordinary
29*956e45f6SSimon J. Gerraty# space before the command is actually run.
30*956e45f6SSimon J. Gerratyfail-multiline:
31*956e45f6SSimon J. Gerraty	echo 'line1\
32*956e45f6SSimon J. Gerraty		line2'; false
33*956e45f6SSimon J. Gerraty
34*956e45f6SSimon J. Gerraty# It is a common style to align the continuation backslashes at the right
35*956e45f6SSimon J. Gerraty# of the lines, usually at column 73.  All spaces before the continuation
36*956e45f6SSimon J. Gerraty# backslash are preserved and are usually outside a shell word and thus
37*956e45f6SSimon J. Gerraty# irrelevant.  Having these spaces collapsed makes sense to show the command
38*956e45f6SSimon J. Gerraty# in its condensed form.
39*956e45f6SSimon J. Gerraty#
40*956e45f6SSimon J. Gerratyfail-multiline-intention:
41*956e45f6SSimon J. Gerraty	echo	'word1'							\
42*956e45f6SSimon J. Gerraty		'word2'; false
43