summaryrefslogtreecommitdiff
path: root/unit-tests/directive-include-fatal.mk
diff options
context:
space:
mode:
authorSimon J. Gerraty <sjg@FreeBSD.org>2020-11-07 19:39:21 +0000
committerSimon J. Gerraty <sjg@FreeBSD.org>2020-11-07 19:39:21 +0000
commit302da1a3d35c15cb29d76e0a939f8bcb13f7ad80 (patch)
treec2146dca82d530521c4d2cc46a95c26964311a2c /unit-tests/directive-include-fatal.mk
parent6bbc783f48498b808e19db4441299dc7d85a278b (diff)
downloadsrc-test2-vendor/NetBSD/bmake/20201101.tar.gz
src-test2-vendor/NetBSD/bmake/20201101.zip
Diffstat (limited to 'unit-tests/directive-include-fatal.mk')
-rwxr-xr-xunit-tests/directive-include-fatal.mk27
1 files changed, 27 insertions, 0 deletions
diff --git a/unit-tests/directive-include-fatal.mk b/unit-tests/directive-include-fatal.mk
new file mode 100755
index 000000000000..22b30ae909c2
--- /dev/null
+++ b/unit-tests/directive-include-fatal.mk
@@ -0,0 +1,27 @@
+# $NetBSD: directive-include-fatal.mk,v 1.2 2020/09/13 10:20:11 rillig Exp $
+#
+# Test for the .include directive combined with fatal errors.
+#
+# At 2020-09-13, the code in Parse_File that sets "fatals = 0" looked
+# suspicious, as if it were possible to suppress fatal errors by including
+# another file. It was a false alarm though, since Parse_File only handles
+# the top-level makefiles from the command line. Any included files are
+# handled by Parse_include_file instead, and that function does not reset
+# the "fatals" counter.
+
+# Using an undefined variable in a condition generates a fatal error.
+.if ${UNDEF}
+.endif
+
+# Including another file does not reset the global variable "fatals".
+# The exit status will be 1.
+.include "/dev/null"
+
+# Adding another file to be included has no effect either.
+# When the command line is parsed, the additional file is only enqueued
+# in the global "makefiles" variable, but not immediately run through
+# Parse_File.
+.MAKEFLAGS: -f "/dev/null"
+
+all:
+ @:;