Home | History | Annotate | Line # | Download | only in unit-tests
cmd-errors-jobs.mk revision 1.7
      1 # $NetBSD: cmd-errors-jobs.mk,v 1.7 2024/07/05 18:59:33 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 
      8 all: 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
     13 undefined:
     14 	: $@-${UNDEFINED}-eol
     15 
     16 unclosed-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 
     22 unclosed-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 
     28 unknown-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
     35 end:
     36 	: $@-eol
     37 
     38 # XXX: Despite the parse errors, the exit status is 0.
     39 # expect: exit status 0
     40