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