]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/opt-debug-file.mk
bc: upgrade to version 3.3.4
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / opt-debug-file.mk
1 # $NetBSD: opt-debug-file.mk,v 1.4 2020/10/05 19:27:48 rillig Exp $
2 #
3 # Tests for the -dF command line option, which redirects the debug log
4 # to a file instead of writing it to stderr.
5
6 # Enable debug logging for variable assignments and evaluation (-dv)
7 # and redirect the debug logging to the given file.
8 .MAKEFLAGS: -dvFopt-debug-file.debuglog
9
10 # This output goes to the debug log file.
11 VAR=    value ${:Uexpanded}
12
13 # Hide the logging output for the remaining actions.
14 # As of 2020-10-03, it is not possible to disable debug logging again.
15 .MAKEFLAGS: -dF/dev/null
16
17 # Make sure that the debug logging file contains some logging.
18 DEBUG_OUTPUT:=  ${:!cat opt-debug-file.debuglog!}
19 # Grmbl.  Because of the := operator in the above line, the variable
20 # value contains ${:Uexpanded}.  This variable expression is expanded
21 # upon further processing.  Therefore, don't read from untrusted input.
22 #.MAKEFLAGS: -dc -dFstderr
23 .if !${DEBUG_OUTPUT:tW:M*VAR = value expanded*}
24 .  error ${DEBUG_OUTPUT}
25 .endif
26
27 # To get the unexpanded text that was actually written to the debug log
28 # file, the content of that log file must not be stored in a variable.
29 # XXX: In the :M modifier, a dollar is escaped as '$$', not '\$'.
30 .if !${:!cat opt-debug-file.debuglog!:tW:M*VAR = value $${:Uexpanded}*}
31 .  error
32 .endif
33
34 _!=     rm opt-debug-file.debuglog
35
36 all:
37         @:;