aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/deptgt-end-fail.mk
blob: 57cdc7da8679d9a9ec00d972fa19e7752a91b4f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# $NetBSD: deptgt-end-fail.mk,v 1.6 2020/12/07 01:04:07 rillig Exp $
#
# Tests for an errors in the main target, its dependencies,
# the .END node and its dependencies.
#
# Before 2020-11-25, an error in the .END target did not print the "Stop.",
# even though this was intended.  The cause for this was a missing condition
# in Compat_Run, in the code handling the .END node.

test: .PHONY

# The default stop-on-error mode is not as interesting to test since it
# stops right after the first error.
.MAKEFLAGS: -k

.for all in ok ERR
.  for all-dep in ok ERR
.    for end in ok ERR
.      for end-dep in ok ERR
.        for target in ${all}-${all-dep}-${end}-${end-dep}
test: ${target}
${target}: .PHONY .SILENT
	echo Test case all=${all} all-dep=${all-dep} end=${end} end-dep=${end-dep}.
	${MAKE} -r -f ${MAKEFILE} \
		all=${all} all-dep=${all-dep} \
		end=${end} end-dep=${end-dep} \
		all; \
	echo "exit status $$?"
	echo
	echo
.        endfor
.      endfor
.    endfor
.  endfor
.endfor

.if make(all)

all all-dep end-dep: .PHONY

CMD.ok=		true
CMD.ERR=	false

all: all-dep
	: Making ${.TARGET} from ${.ALLSRC}.
	@${CMD.${all}}

all-dep:
	: Making ${.TARGET} out of nothing.
	@${CMD.${all-dep}}

.END: end-dep
	: Making ${.TARGET} from ${.ALLSRC}.
	@${CMD.${end}}

end-dep:
	: Making ${.TARGET} out of nothing.
	@${CMD.${end-dep}}

.endif

# Until 2020-12-07, several of the test cases printed "`all' not remade
# because of errors.", followed by "exit status 0", which contradicted
# each other.

# Until 2020-12-07, '.END' was even made if 'all' failed, but if a dependency
# of 'all' failed, it was skipped.  This inconsistency was not needed for
# anything and thus has been dropped.  To run some commands on error, use the
# .ERROR target instead, see deptgt-error.mk.