xref: /freebsd/contrib/bmake/unit-tests/cmd-errors-jobs.mk (revision 7937bfbc0ca53fe7cdd0d54414f9296e273a518e)
1# $NetBSD: cmd-errors-jobs.mk,v 1.8 2024/07/09 19:43:01 rillig Exp $
2#
3# Demonstrate how errors in expressions affect whether the commands
4# are actually executed in jobs mode.
5
6.MAKEFLAGS: -j1
7
8all: undefined unclosed-expression unclosed-modifier unknown-modifier end
9
10# Undefined variables in expressions are not an error.  They expand to empty
11# strings.
12# expect: : undefined--eol
13undefined:
14	: $@-${UNDEFINED}-eol
15
16unclosed-expression:
17# expect: make: in target "unclosed-expression": Unclosed variable "UNCLOSED"
18# XXX: This command is executed even though it contains parse errors.
19# expect: : unclosed-expression-
20	: $@-${UNCLOSED
21
22unclosed-modifier:
23# expect: make: in target "unclosed-modifier": while evaluating variable "UNCLOSED" with value "": Unclosed expression, expecting '}'
24# XXX: This command is executed even though it contains parse errors.
25# expect: : unclosed-modifier-
26	: $@-${UNCLOSED:
27
28unknown-modifier:
29# expect: make: in target "unknown-modifier": while evaluating variable "UNKNOWN" with value "": Unknown modifier "Z"
30# XXX: This command is executed even though it contains parse errors.
31# expect: : unknown-modifier--eol
32	: $@-${UNKNOWN:Z}-eol
33
34# expect: : end-eol
35end:
36	: $@-eol
37
38# expect: exit status 2
39