xref: /freebsd/contrib/bmake/unit-tests/directive-include-fatal.mk (revision 02e9120893770924227138ba49df1edb3896112a)
1# $NetBSD: directive-include-fatal.mk,v 1.4 2023/06/01 20:56:35 rillig Exp $
2#
3# Test for the .include directive combined with fatal errors.
4#
5# At 2020-09-13, the code in Parse_File that sets "fatals = 0" looked
6# suspicious, as if it were possible to suppress fatal errors by including
7# another file.  It was a false alarm though, since Parse_File only handles
8# the top-level makefiles from the command line.  Any included files are
9# handled by IncludeFile instead, and that function does not reset
10# the "fatals" counter.
11
12# Using an undefined variable in a condition generates a fatal error.
13# expect+1: Malformed conditional (${UNDEF})
14.if ${UNDEF}
15.endif
16
17# Including another file does not reset the global variable "fatals".
18# The exit status will be 1.
19.include "/dev/null"
20
21# Adding another file to be included has no effect either.
22# When the command line is parsed, the additional file is only enqueued
23# in the global "makefiles" variable, but not immediately run through
24# Parse_File.
25.MAKEFLAGS: -f "/dev/null"
26
27all:
28	@:;
29