Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make/unit-tests make(1): add tests for the various ....



details:   https://anonhg.NetBSD.org/src/rev/18b036329481
branches:  trunk
changeset: 976131:18b036329481
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Sep 13 09:20:23 2020 +0000

description:
make(1): add tests for the various .include directives

diffstat:

 usr.bin/make/unit-tests/Makefile                     |   7 +++++-
 usr.bin/make/unit-tests/directive-dinclude.exp       |   1 +
 usr.bin/make/unit-tests/directive-dinclude.mk        |   9 ++++++++
 usr.bin/make/unit-tests/directive-hyphen-include.exp |   1 +
 usr.bin/make/unit-tests/directive-hyphen-include.mk  |   9 ++++++++
 usr.bin/make/unit-tests/directive-include-fatal.exp  |   4 +++
 usr.bin/make/unit-tests/directive-include-fatal.mk   |  21 ++++++++++++++++++++
 usr.bin/make/unit-tests/directive-include.exp        |   1 +
 usr.bin/make/unit-tests/directive-include.mk         |   8 +++++++
 usr.bin/make/unit-tests/directive-sinclude.exp       |   1 +
 usr.bin/make/unit-tests/directive-sinclude.mk        |   9 ++++++++
 11 files changed, 70 insertions(+), 1 deletions(-)

diffs (138 lines):

diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/Makefile
--- a/usr.bin/make/unit-tests/Makefile  Sun Sep 13 09:17:47 2020 +0000
+++ b/usr.bin/make/unit-tests/Makefile  Sun Sep 13 09:20:23 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.139 2020/09/13 09:17:47 rillig Exp $
+# $NetBSD: Makefile,v 1.140 2020/09/13 09:20:23 rillig Exp $
 #
 # Unit tests for make(1)
 #
@@ -121,6 +121,7 @@
 TESTS+=                dir
 TESTS+=                dir-expand-path
 TESTS+=                directive
+TESTS+=                directive-dinclude
 TESTS+=                directive-elif
 TESTS+=                directive-elifdef
 TESTS+=                directive-elifmake
@@ -134,12 +135,16 @@
 TESTS+=                directive-export-literal
 TESTS+=                directive-for
 TESTS+=                directive-for-generating-endif
+TESTS+=                directive-hyphen-include
 TESTS+=                directive-if
 TESTS+=                directive-ifdef
 TESTS+=                directive-ifmake
 TESTS+=                directive-ifndef
 TESTS+=                directive-ifnmake
+TESTS+=                directive-include
+TESTS+=                directive-include-fatal
 TESTS+=                directive-info
+TESTS+=                directive-sinclude
 TESTS+=                directive-undef
 TESTS+=                directive-unexport
 TESTS+=                directive-unexport-env
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-dinclude.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-dinclude.exp    Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,1 @@
+exit status 0
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-dinclude.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-dinclude.mk     Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: directive-dinclude.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+#
+# Tests for the .dinclude directive, which includes another file,
+# typically named .depend.
+
+# TODO: Implementation
+
+all:
+       @:;
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-hyphen-include.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-hyphen-include.exp      Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,1 @@
+exit status 0
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-hyphen-include.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-hyphen-include.mk       Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: directive-hyphen-include.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+#
+# Tests for the .-include directive, which includes another file,
+# silently skipping it if it cannot be opened.
+
+# TODO: Implementation
+
+all:
+       @:;
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-include-fatal.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-include-fatal.exp       Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,4 @@
+make: "directive-include-fatal.mk" line 10: Malformed conditional (${UNDEF})
+make: Fatal errors encountered -- cannot continue
+make: stopped in unit-tests
+exit status 1
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-include-fatal.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-include-fatal.mk        Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,21 @@
+# $NetBSD: directive-include-fatal.mk,v 1.1 2020/09/13 09:20:23 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"
+
+all:
+       @:;
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-include.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-include.exp     Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,1 @@
+exit status 0
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-include.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-include.mk      Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: directive-include.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+#
+# Tests for the .include directive, which includes another file.
+
+# TODO: Implementation
+
+all:
+       @:;
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-sinclude.exp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-sinclude.exp    Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,1 @@
+exit status 0
diff -r ed2b44509aa3 -r 18b036329481 usr.bin/make/unit-tests/directive-sinclude.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/usr.bin/make/unit-tests/directive-sinclude.mk     Sun Sep 13 09:20:23 2020 +0000
@@ -0,0 +1,9 @@
+# $NetBSD: directive-sinclude.mk,v 1.1 2020/09/13 09:20:23 rillig Exp $
+#
+# Tests for the .sinclude directive, which includes another file,
+# silently skipping it if it cannot be opened.
+
+# TODO: Implementation
+
+all:
+       @:;



Home | Main Index | Thread Index | Old Index