xref: /freebsd/contrib/bmake/unit-tests/directive-include-fatal.mk (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1# $NetBSD: directive-include-fatal.mk,v 1.3 2021/02/01 22:16:57 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.if ${UNDEF}
14.endif
15
16# Including another file does not reset the global variable "fatals".
17# The exit status will be 1.
18.include "/dev/null"
19
20# Adding another file to be included has no effect either.
21# When the command line is parsed, the additional file is only enqueued
22# in the global "makefiles" variable, but not immediately run through
23# Parse_File.
24.MAKEFLAGS: -f "/dev/null"
25
26all:
27	@:;
28