xref: /freebsd/contrib/bmake/unit-tests/compat-error.mk (revision 8881d206f4e68b564c2c5f50fc717086fc3e827a)
1# $NetBSD: compat-error.mk,v 1.3 2020/12/13 19:33:53 rillig Exp $
2#
3# Test detailed error handling in compat mode.
4#
5# Until 2020-12-13, .ERROR_TARGET was success3, which was wrong.
6# Since compat.c 1.215 from 2020-12-13, it is 'fail1', which is the first
7# failed top-level target.  XXX: Even better would be if .ERROR_TARGET were
8# the smallest target that caused the build to fail, even if it were a
9# sub-sub-sub-dependency of a top-level target.
10#
11# XXX: As of 2020-12-13, .ERROR_CMD is empty, which is wrong.
12#
13# See also:
14#	Compat_Run
15#
16#	The commit that added the NULL command to gn->commands:
17#		CVS: 1994.06.06.22.45.??
18#		Git: 26a8972fd7f982502c5fbfdabd34578b99d77ca5
19#		1994: Lst_Replace (cmdNode, (ClientData) NULL);
20#		2020: LstNode_SetNull(cmdNode);
21#
22#	The commit that skipped NULL commands for .ERROR_CMD:
23#		CVS: 2016.08.11.19.53.??
24#		Git: 58b23478b7353d46457089e726b07a49197388e4
25
26.MAKEFLAGS: success1 fail1 success2 fail2 success3
27
28success1 success2 success3:
29	: Making ${.TARGET} out of nothing.
30
31fail1 fail2:
32	: Making ${.TARGET} out of nothing.
33	false '${.TARGET}' '$${.TARGET}' '$$$${.TARGET}'
34
35.ERROR:
36	@echo ${.TARGET} target: '<'${.ERROR_TARGET:Q}'>'
37	@echo ${.TARGET} command: '<'${.ERROR_CMD:Q}'>'
38